Skip to content

[Bug] Kbd and useHotkeys disagree on the combo string vocabulary, so a working shortcut can render the wrong hint #5403

Description

@Astro-Han

Description

useHotkeys and Kbd take the same '+'-separated combo string, but each keeps its own key vocabulary. useHotkeys resolves aliases through KEY_ALIASES (esc, space, up, down, left, right, return, plus) and accepts mod/ctrl/meta/alt/shift as modifiers. Kbd resolves through KEY_DISPLAY and KEY_LABEL, a different set, and falls back to key.toUpperCase() for anything it does not recognise.

Where the two sets differ, the shortcut works and the hint is wrong:

combo useHotkeys Kbd renders
return fires on Enter RETURN, not ↵
meta valid modifier META
esc fires on Escape ESC (the map has escapeEsc)
space fires on Space SPACE

Same failure mode as #5253: the handler and the hint disagree, and because the hint looks plausible, nothing reads as broken. #5253 was two copies of one platform check; this is two copies of one key vocabulary.

Suggested direction: one vocabulary both surfaces read, the way isApplePlatform became one detection in #5394.

Reproduction

useHotkeys([{keys: 'return', onPress: doThing}]);  // fires on Enter
<Kbd keys="return" />                              // renders "RETURN"

Same for meta, esc, and space.

Astryx Version

@astryxdesign/core@0.4.7

Environment

Any browser and OS. Not platform dependent.


Diagnosis and draft prepared with Claude Code; reviewed and verified by the contributor before filing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions