diff options
author | Paladox none <thomasmulhall410@yahoo.com> | 2021-11-26 11:14:14 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-11-26 11:14:14 +0000 |
commit | 43f33513350de55f624d16ad54603a7a08d4defc (patch) | |
tree | b2d831ff21e7a26a9ec8271c974e6b1b183eae8a | |
parent | 0bf6b14fbe6d9849bf9100f5d7db05759a95c5a9 (diff) | |
parent | 6d92b8c6d7ec9c900379b2004d7e8c6be7285042 (diff) |
Merge "Fix listening on ENTER shortcut in <gr-file-list>" into stable-3.5
-rw-r--r-- | polygerrit-ui/app/utils/dom-util.ts | 5 | ||||
-rw-r--r-- | polygerrit-ui/app/utils/dom-util_test.ts | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/polygerrit-ui/app/utils/dom-util.ts b/polygerrit-ui/app/utils/dom-util.ts index e2fa8feb54..dd408d38a8 100644 --- a/polygerrit-ui/app/utils/dom-util.ts +++ b/polygerrit-ui/app/utils/dom-util.ts @@ -452,7 +452,10 @@ export function shouldSuppress(e: KeyboardEvent): boolean { // Suppress shortcuts if the key is 'enter' // and target is an anchor or button or paper-tab. (e.keyCode === 13 && - (tagName === 'A' || tagName === 'BUTTON' || tagName === 'PAPER-TAB')) + (tagName === 'A' || + tagName === 'BUTTON' || + tagName === 'GR-BUTTON' || + tagName === 'PAPER-TAB')) ) { return true; } diff --git a/polygerrit-ui/app/utils/dom-util_test.ts b/polygerrit-ui/app/utils/dom-util_test.ts index 9dd5be273b..5429550e15 100644 --- a/polygerrit-ui/app/utils/dom-util_test.ts +++ b/polygerrit-ui/app/utils/dom-util_test.ts @@ -320,6 +320,15 @@ suite('dom-util tests', () => { }); }); + test('suppress "enter" shortcut event from <gr-button>', async () => { + await keyEventOn( + document.createElement('gr-button'), + e => assert.isTrue(shouldSuppress(e)), + 13, + 'enter' + ); + }); + test('suppress "enter" shortcut event from <a>', async () => { await keyEventOn(document.createElement('a'), e => { assert.isFalse(shouldSuppress(e)); |