Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keys for the global keyboard listener of PlayControlNode should be customizable #680

Open
jessegreenberg opened this issue Jun 22, 2021 · 1 comment
Assignees

Comments

@jessegreenberg
Copy link
Contributor

Currently, the only way to change the global hotkey listener added to the PlayControlNode is to remove it entirely with includeGlobalHotKey, a boolean option that prevents the listener from being added.

It would be much better if we could customize the hotkeys that fire the global key listener. This should be a general design pattern for hot keys in common code. It is OK for there to be a default hot key, but it should be customizable.

Relevant Slack conversation:

Putting the hot key in PlayControlButton is problematic. What if I have 2 play/pause buttons on a screen, for controlling different things?   PlayControlButton has options.includeGlobalHotKey only, so you’re out of luck.

Jesse Greenberg  2:36 PM
Wouldn't that option cover it? If you had two you would probably want to disable the hotkey.

Chris Malley  2:37 PM
Not at all.  PlayControlButton is a reusable UI component, designed to be used in many contexts.  Assuming that there is only 1 hot key is also assuming that there is only 1 context.
2:38
It’s OK for reusable UI components to have default hot keys. But they should not be limited to only 1 hot key.

Jesse Greenberg  2:40 PM
OK, gotchya. We can make the hotkeys for that listener customizable.

Chris Malley  2:40 PM
That should be the general pattern for anything in common code.
@zepumph
Copy link
Member

zepumph commented Oct 6, 2022

Subset of phetsims/scenery#1298

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants