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

Improve alt input press and hold behavior for buttons #893

Open
jessegreenberg opened this issue Sep 18, 2024 · 1 comment
Open

Improve alt input press and hold behavior for buttons #893

jessegreenberg opened this issue Sep 18, 2024 · 1 comment
Assignees

Comments

@jessegreenberg
Copy link
Contributor

It is unfortunate that all buttons have a press-and-hold behavior with the Enter key. For example, tab to a ResetAllButton and press and hold the Enter key; it fires continuously, spamming the reset action and repeatedly playing the sound.

Buttons fire on the click event, which is handled differently by user agents, browsers, and operating systems. It is most accessible and simple if we continue firing buttons in response to the click event without special behavior for keyup/keydown events.

Is there a way we can improve this for PhET sims while staying compatible with assistive devices?

Just brainstorming – one possible solution could be to add a time-based throttle, only allowing click events at a certain interval. This could be customized with an option.

From #796.

@terracoda
Copy link
Contributor

So the exact difference is that

  • the Space key fires a click event on the up event
  • the Enter key fires a click event on the down event and as long as the key remains down, it keeps firing click events.

There are many examples where this repeat fire behavior is not desirable. It can cause color and animations to flash and sounds and description to repeat. There may be specific interaction contexts where this behavior is desirable. For example, in Projectile Data Lab, the Launch button is accompanied by a radio button group for Single or Continuous firing of objects. Might the repeat-fire behavior be useful in this case where both a single and continuous option are desired?

@jessegreenberg, I like the idea of a time-based throttle option.

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

2 participants