Skip to content

Commit

Permalink
Keycodes: fix problem with tilde (~) character not displaying properly (
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano authored Dec 30, 2022
1 parent c14a77b commit 0b8030d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/keycodes/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,11 @@ export const displayShortcutList = mapValues( modifiers, ( modifier ) => {
/** @type {string[]} */ ( [] )
);

// Symbols (`,.) are removed by the default regular expression,
// Symbols (~`,.) are removed by the default regular expression,
// so override the rule to allow symbols used for shortcuts.
// see: https://github.com/blakeembrey/change-case#options
const capitalizedCharacter = capitalCase( character, {
stripRegexp: /[^A-Z0-9`,\.\\\-]/gi,
stripRegexp: /[^A-Z0-9~`,\.\\\-]/gi,
} );

return [ ...modifierKeys, capitalizedCharacter ];
Expand Down Expand Up @@ -298,6 +298,8 @@ export const shortcutAriaLabel = mapValues( modifiers, ( modifier ) => {
'.': __( 'Period' ),
/* translators: backtick as in the character '`' */
'`': __( 'Backtick' ),
/* translators: tilde as in the character '~' */
'~': __( 'Tilde' ),
};

return [ ...modifier( _isApple ), character ]
Expand Down

0 comments on commit 0b8030d

Please sign in to comment.