Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Add a constant to Closure KeyCodes API for FireFox +/* key on German …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Closure Team authored and copybara-github committed Oct 18, 2023
1 parent 468f403 commit 7a06212
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions closure/goog/events/keycodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7a06212

Please sign in to comment.