Skip to content

fix: use correct key names for key codes#9746

Open
maribethb wants to merge 1 commit intoRaspberryPiFoundation:v13from
maribethb:key-names
Open

fix: use correct key names for key codes#9746
maribethb wants to merge 1 commit intoRaspberryPiFoundation:v13from
maribethb:key-names

Conversation

@maribethb
Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes #9741
Fixes #9740

Proposed Changes

  • adds a mapping of key code to user-facing key name. this isn't perfect because the keyCode system is not really applicable to non-US layouts, but it's what we've got. the mapping uses Msg keys for keys with text on them and symbols for others.
  • adjusts the shortcut formatting utils to use the mapping instead of assuming String.fromCharCode always works, though we do fall back to that if it's a key code we don't know.
  • removes internal from the methods that get you the keys from the shortcut name
  • changed the name and all references to action to reference shortcuts instead from the shortcuts formatting class. "Action" was a terminology we introduced in the keyboard experiment, but we don't use it elsewhere in core and all of the usage of it here was using it to refer to shortcut names. Best to just use the existing terminology. This is not a breaking change because previously these methods were both unreleased and internal only.

Reason for Changes

  • Both we and application owners / plugin authors have various use cases for getting a single key combination to display to users for a given shortcut.

Test Coverage

there weren't any existing tests for the shortcut formatter and i didn't add any, but i can do that tomorrow

Documentation

Additional Information

@maribethb maribethb requested a review from a team as a code owner April 21, 2026 21:38
@maribethb maribethb requested a review from gonfunko April 21, 2026 21:38
@github-actions github-actions Bot added the PR: fix Fixes a bug label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants