Skip to content

Commit

Permalink
Keyboard Shortcuts: fix settings sidebar toggle shortcut (#43428)
Browse files Browse the repository at this point in the history
* Keyboard Shortcuts: fix settings sidebar toggle shortcut

* Consider Keyboard layouts
  • Loading branch information
t-hamano committed Sep 20, 2022
1 parent 349240a commit ca6d528
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/keycodes/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,18 @@ export const isKeyboardEvent = mapValues( modifiers, ( getModifiers ) => {
key = String.fromCharCode( event.keyCode ).toLowerCase();
}

// Replace some characters to match the key indicated
// by the shortcut on Windows.
if ( ! _isApple() ) {
if (
event.shiftKey &&
character.length === 1 &&
event.code === 'Comma'
) {
key = ',';
}
}

// For backwards compatibility.
if ( character === 'del' ) {
character = 'delete';
Expand Down

0 comments on commit ca6d528

Please sign in to comment.