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

Interval for firing button listeners when holding down enter key #424

Closed
jessegreenberg opened this issue Dec 18, 2018 · 12 comments
Closed

Comments

@jessegreenberg
Copy link
Contributor

This came from phetsims/resistance-in-a-wire#193. If using a keyboard PhET buttons can be clicked as fast as the user presses them. This includes pressing and holding enter on a button, in which case the button is clicked every couple of milliseconds, and that delay is determined by OS settings.

For example, got to https://phet-dev.colorado.edu/html/resistance-in-a-wire/1.6.0-rc.2/phet/resistance-in-a-wire_en_phet.html and tab to the Reset All button then press and hold enter on it. You will her a stream of the "Reset All" sounds as the button is fired continuously.

Some button models in sun already have "fireOnHold" configurations and delays hopefully a11y can use these directly.

@jessegreenberg
Copy link
Contributor Author

Another example - if you go press and hold "Enter" while focus is on the "Remove Wall" button in BASE, the user will get an infinite stream of "Wall added..." "Wall removed..." alerts.

@jessegreenberg
Copy link
Contributor Author

jessegreenberg commented Dec 18, 2018

I am unsure if the current behavior with the reset-all button should block publication of new sims, adding the label until we figure out.

Blocking publication for any sims that are being deployed with a11y enabled.

@emily-phet
Copy link

@jessegreenberg @zepumph Let's wait on this fix for the next round of sims and move forward with RIAW and Friction.

@jessegreenberg
Copy link
Contributor Author

Thanks @emily-phet sounds good, in that case removing the blocks-publication label.

@jessegreenberg
Copy link
Contributor Author

A "button specific fix" was added to the Reset All button for RIAW, and we should do this for the sound toggle button for the upcoming friction release.

@zepumph
Copy link
Member

zepumph commented Dec 19, 2018

I may not understand this issue fully, so please pardon me if this is not right. What about the keyboard help button, could someone spam both the nav bar button and the dialog's "x" to close it out really fast and encounter this issue too? This seems so sloppy to require this on each instance. Is there any hope of having a general solution for this?

@jessegreenberg
Copy link
Contributor Author

The original report of this issue was that pressing and holding enter on the Reset All button caused VO to announce the reset alert indefinitely, and the same will happen for alerts from the sound toggle button. The case you mention is definitely related to this but not problematic for a11y in the same way because it doesn't involve alerts.

I feel confident that we will have a general solution for this, but I don't feel confident that this will be completed by the end of the week or that the changes can be easily patched into the release branch of RIAW without starting fresh with a new round of testing.

Totally agree it is sloppy to have the workaround at two instances, but this is not the long term solution.

@zepumph
Copy link
Member

zepumph commented Dec 19, 2018

Understood thanks!

@jessegreenberg
Copy link
Contributor Author

jessegreenberg commented Dec 19, 2018

Adding back the blocks-publication label as this should be fixed before the round of a11y sims is published. This does not apply to Friction and RIAW.

This issue only applies to sims with a11y enabled.

@pixelzoom
Copy link
Contributor

This and #463 are related. Sun buttons have a fireOnHold option that is currently not integrated with a11y. This feature should work the same regardless of whether the user is holding down a pointer or a key.

@pixelzoom
Copy link
Contributor

pixelzoom commented Feb 27, 2019

The title of this issue is "Interval for firing button listeners when holding down enter key", but in phetsims/scenery#939 (comment) we concluded that Enter and Space should behave the same. So are we planning to support fire-on-hold for Space? And how do we do that when we only get click on release when using 'button' role?

@jessegreenberg
Copy link
Contributor Author

Sun buttons have a fireOnHold option that is currently not integrated with a11y. This feature should work the same regardless of whether the user is holding down a pointer or a key.

In phetsims/scenery#939 we concluded that for screen reader and a11y interaction buttons will continue to operate in a way that is native for the web. So buttons will generally fire continuously when pressing and holding down enter and fire once on release of spacebar.

For unique buttons that require specific intervals when holding down enter, or that must only fire on key release we are going to proceed with phetsims/scenery#939 (comment), which involves changing the markup for certain buttons and keydown and keyup listeners to PressListener so that the following PushButtonModel options will work in a way that matches pointer input.

      fireOnDown: false, // true: fire on pointer down; false: fire on pointer up if pointer is over button
      fireOnHold: false, // is the fire-on-hold feature enabled?
      fireOnHoldDelay: 400, // start to fire continuously after pressing for this long (milliseconds)
      fireOnHoldInterval: 100, // fire continuously at this interval (milliseconds), same default as in ButtonModel

That work is going to be done in phetsims/scenery#939 so this issue can be closed. Please see phetsims/scenery#939 for discussion about why PhET decided not to do a project-specific solution for accessible buttons.

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

4 participants