webui: make cr-dialog capture enter key presses from any input element

Currently, the cr-dialog key press handler only triggers an action
button click when an enter keypress event has an 'CR-INPUT' target. This
means that if a cr-input is embedded in another custom element inside
the cr-dialog, enter key presses to that cr-input  will be ignored
because the corresponding event gets retargeted to the custom element.

Instead, make the keypress handler check that the first element in the
composedPath() is an 'INPUT'.

Bug: 955859
Change-Id: I486158fadbc32b95c3c3284240bfe4ae690d78d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1677597
Commit-Queue: Martin Kreichgauer <martinkr@google.com>
Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672635}
2 files changed