closure-library icon indicating copy to clipboard operation
closure-library copied to clipboard

Keyboard event lookup fails for Escape key

Open drstonebraker opened this issue 5 years ago • 2 comments

When registering a shortcut with goog.ui.KeyboardShortcutHandler for the escape key with a key name, one must use 'esc' instead of 'escape', since the goog.events.KeyNames does not have 'escape'. However, the real key name used by most modern browsers (exception being IE and Edge) for the escape key is "Escape" (per spec). So when a shortcut is registered and the escape key is pressed in a newer browser, the lookup for a registered key named "Escape" fails, and it instead falls back to using the keyCode.

This is a problem since keyCode is deprecated and some testing libraries expect to be able to create KeyboardEvent objects using the spec'ed name for this key: 'Escape'

drstonebraker avatar May 06 '20 20:05 drstonebraker

Do you see a reasonable way to support both? What do you propose to fix this?

shicks avatar Jun 02 '20 07:06 shicks

Unfortunately I don't

drstonebraker avatar Jun 16 '20 02:06 drstonebraker