From 0b8030d1c6f3cd598c77ffbc4542ca2f9df4c0c5 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Fri, 30 Dec 2022 19:12:55 +0900 Subject: [PATCH] Keycodes: fix problem with tilde (~) character not displaying properly (#46826) --- packages/keycodes/src/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/keycodes/src/index.js b/packages/keycodes/src/index.js index 5bb776127d95e..fe21171c0c7a9 100644 --- a/packages/keycodes/src/index.js +++ b/packages/keycodes/src/index.js @@ -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 ]; @@ -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 ]