Skip to content

fix(hotkey): render platform-aware hotkey legend#361

Open
gularsson wants to merge 1 commit into
mainfrom
feature/elelog-624-textbit-hotkey
Open

fix(hotkey): render platform-aware hotkey legend#361
gularsson wants to merge 1 commit into
mainfrom
feature/elelog-624-textbit-hotkey

Conversation

@gularsson
Copy link
Copy Markdown
Contributor

Menu.Hotkey rendered Mac glyphs (⌘ ⌥ ⌃ ⇧) for every platform, leaving Windows, Linux and Chromebook editors with opaque labels that did not match the keys they had to press.

modifier() now consults an isMac() check that prefers navigator.userAgentData.platform, falls back to navigator.platform, and finally to navigator.userAgent. The result is captured once at module load as IS_MAC and used as modifier()'s default so the per-render menu path doesn't re-probe the navigator on every action. Mac users keep the Unicode glyphs; everyone else now sees spelled-out modifier names joined by "+", e.g. "Ctrl+Alt+1", "Ctrl+B", "Ctrl+Alt+Up".

isMac is also exported from the library entry so consumers can stop reinventing the detection.

Refs ELELOG-624

Menu.Hotkey rendered Mac glyphs (⌘ ⌥ ⌃ ⇧) for every platform, leaving
Windows, Linux and Chromebook editors with opaque labels that did not
match the keys they had to press.

modifier() now consults an isMac() check that prefers
navigator.userAgentData.platform, falls back to navigator.platform, and
finally to navigator.userAgent. The result is captured once at module
load as IS_MAC and used as modifier()'s default so the per-render menu
path doesn't re-probe the navigator on every action. Mac users keep the
Unicode glyphs; everyone else now sees spelled-out modifier names joined
by "+", e.g. "Ctrl+Alt+1", "Ctrl+B", "Ctrl+Alt+Up".

isMac is also exported from the library entry so consumers can stop
reinventing the detection.

Refs ELELOG-624
@gularsson gularsson self-assigned this May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants