I discovered this while working on adding a hotkey to keyboard help for Fourier in https://github.com/phetsims/fourier-making-waves/issues/93. MAL was used as the model for doing this. What I see is that the help content for a hotkey is not at all related to the actual implementation of a hotkey, so the info for a hotkey is spread out and duplicated.
An example from MAL.
MAL has keyboard help content for TimeControlNode, which uses PlayControlButton.
In PlayControlButton.js, the hotkey is implemented as Alt+K:
Now I've identified 3 places where the Alt key is specified.
This is not a scalable/sustainable way to specify hot keys and their help content. If I wanted to change this hotkey from Alt+K to Option-M, I'd have to find and change 6 places in the code.
I discovered this while working on adding a hotkey to keyboard help for Fourier in https://github.com/phetsims/fourier-making-waves/issues/93. MAL was used as the model for doing this. What I see is that the help content for a hotkey is not at all related to the actual implementation of a hotkey, so the info for a hotkey is spread out and duplicated.
An example from MAL.
MAL has keyboard help content for TimeControlNode, which uses PlayControlButton.
In PlayControlButton.js, the hotkey is implemented as Alt+K:
In MoleculesAndLightKeyboardHelpContent.js, utility method
KeyboardHelpSection.createPlayPauseKeyRow
is used to create the keyboard help content:It looks like this:
Looking at
KeyboardHelpSection.createPlayPauseKeyRow
, it hardcodes 'K':Looking at
pauseOrPlayShortcutDescriptionString
, it hardcodes both 'Alt' and 'K':So I've identified 3 places where the 'K' key is specified.
Now looking into
KeyboardHelpSection.createGlobalHotkeyRow
, it also hardcodes 'Alt' viaTextKeyNode.alt()
:Now I've identified 3 places where the Alt key is specified.
This is not a scalable/sustainable way to specify hot keys and their help content. If I wanted to change this hotkey from Alt+K to Option-M, I'd have to find and change 6 places in the code.