From 7a062125c5d51342d52ee90160ba0f8a09de44d1 Mon Sep 17 00:00:00 2001 From: Closure Team Date: Wed, 18 Oct 2023 07:50:18 -0700 Subject: [PATCH] Add a constant to Closure KeyCodes API for FireFox +/* key on German layouts and treats it as a character key for FF. The close bracket key on US keyboard layouts corresponds to the +/* key on DE keyboard layouts (the same physical key on the keyboard produces different outputs depending on keyboard layout). Firefox sends a unique keycode for this (171), which differs from the keycode sent by Chrome (221). (See: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode) RELNOTES:Added a keycodes.js constant for the +/* key in Firefox for DE keyboard layouts. PiperOrigin-RevId: 574474491 Change-Id: Iefdcefa8f4d860c61ffd9e648dc553e871d14fb1 --- closure/goog/events/keycodes.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/closure/goog/events/keycodes.js b/closure/goog/events/keycodes.js index 4cb1b16f6e..d7db07c968 100644 --- a/closure/goog/events/keycodes.js +++ b/closure/goog/events/keycodes.js @@ -70,6 +70,8 @@ goog.events.KeyCodes = { // SINGLE_QUOTE (US keyboard layout) or SEMICOLON (JP keyboard layout in // chrome) FF_JP_QUOTE: 58, + FF_DE_PLUS: 171, // Firefox (Gecko) fires this for +/* on DE keyboards + // rather than CLOSE_SQUARE_BRACKET (DE layout in Chrome) QUESTION_MARK: 63, // needs localization AT_SIGN: 64, A: 65, @@ -402,6 +404,7 @@ goog.events.KeyCodes.isCharacterKey = function(keyCode) { case goog.events.KeyCodes.FF_JP_QUOTE: return true; case goog.events.KeyCodes.FF_DASH: + case goog.events.KeyCodes.FF_DE_PLUS: return goog.userAgent.GECKO; default: return false;