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

Keyboard-based interaction with laser and particle source buttons is incorrect #128

Open
jbphet opened this issue Feb 19, 2025 · 5 comments
Assignees

Comments

@jbphet
Copy link
Collaborator

jbphet commented Feb 19, 2025

Over Slack, @kathy-phet said:

We are noticing that the button both photons and particle source has the wrong button behavior. When using a keyboard, it should just fire once and release. It should not require a second "space bar tap" to release it. Can you make an issue and fix it? Not sure if this is common code behavior needs to be refined or needs another option, or if the option is there and just implemented with incorrect behavior. Thanks!

@jbphet jbphet self-assigned this Feb 19, 2025
@jbphet
Copy link
Collaborator Author

jbphet commented Feb 19, 2025

My initial investigation on this is making it look like more of a common code issue. I'm not seeing any obvious options to control this behavior, and other places where this type of button is being used have the same behavior reported above, namely that the space bar has to be pressed and released once to push the button down, then pressed and released again to release the button. I'm seeing this in the "pH Scale" sim and in the EyeDropperNode demo in the scenery-phet test app.

@zepumph
Copy link
Member

zepumph commented Feb 24, 2025

I believe that the central issue tracking this problem is phetsims/sun#796. I hope that is helpful.

@jbphet
Copy link
Collaborator Author

jbphet commented Feb 26, 2025

I discussed this issue with various members of the dev team over Slack, and based on what I learned there I set up a meeting with @jessegreenberg, who seemed to know the most about keyboard-button interaction. There I learned that he and @terracoda had worked quite a bit to refine the keyboard interaction with PhET's buttons, and probably our best option in this case is to use a push button instead of the momentary button or toggle button that are available as options for the LaserPointerNode because this has keyboard interactions closer to what we need. I started down the road of making pushButton an option for the LaserPointerNode, but that became complicated, and I ended up having the sim-specific code create its own button and pass that in as a child to LaserPointerNode.

@jbphet
Copy link
Collaborator Author

jbphet commented Feb 26, 2025

I've reviewed the updated keyboard interaction behavior in a meeting with the design team and, while they would have preferred to be able to fire the photon on a press of the space bar instead of a release, they said the behavior after the commits above was acceptable.

There is one odd thing we would like to correct in the common code long term: Pressing and holding the Enter key results in very rapid continuous firing of the button listener. Adding a value for the fireOnHoldInterval option has no effect. There is a comment in PushButtonModel that says:

  // TODO: these options are not supported with PDOM interaction, see https://github.com/phetsims/scenery/issues/1117

So hopefully, once phetsims/scenery#1117 is fixed, this can be adjusted so that holding down the Enter key results in a better behavior.

@jbphet
Copy link
Collaborator Author

jbphet commented Feb 26, 2025

I'm tempted to simply close this, but I thought it wise to have @arouinfar try it out and make sure we're good with this behavior.

@jbphet jbphet assigned arouinfar and unassigned jbphet Feb 26, 2025
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

No branches or pull requests

3 participants