-
Notifications
You must be signed in to change notification settings - Fork 353
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
Button: Space should only activate on keyup #610
Comments
I will address this issue in a follow-up pull request to #609, once it is merged. Have it implemented locally. |
@kleinfreund, are you still planning to submit a PR for this? @spectranaut, does this impact button tests in PR #849? |
@mcking65 I didn’t have this in mind anymore. I simply forgot about it. Sorry for that; I’m on it now. One thing: For the toggle button’s click event, it is explicitly checked whether the target element is something like a button (i.e. either is a if (event.target.getAttribute('role') === 'button' || event.target.tagName === 'button') {
toggleButtonState(event);
} This check is not in place for any other event and only for the toggle button. In particular, the action button (implemented as a I would like to remove this check. Currently, it’s not helpful because the examples will fulfill either criteria anyway. Otherwise, we would need to introduce such safety checks in a lot of other places, too. Regarding the tests in #849: As far as I can tell from the test file, the tests don’t distinquish between event types. Instead, a fixed amount of time is waited after which the test condition is evaluated. |
hi @mcking65, nope, this bug does not effect the regression tests. The tests send a key and wait for a state change -- they do not test whether the state change happens at the time of keypress or keyup. |
To resolve issue #610, activate buttons on keyup when space is pressed. Enter key behavior is not changed. Makes behavior consistent with HTML button elements.
To resolve issue w3c#610, activate buttons on keyup when space is pressed. Enter key behavior is not changed. Makes behavior consistent with HTML button elements.
To resolve issue w3c#610, activate buttons on keyup when space is pressed. Enter key behavior is not changed. Makes behavior consistent with HTML button elements.
This can be closed, no? |
Yep, this was resolved by #858. Closing. |
The synthetic click event that happens on native
<button>
elements occurs on keydown for Enter and keyup for Space, but the button pattern doesn't describe this behavior and the example does not exhibit it. For instance, holding down the space bar on the "Mute" button toggles it off and on until you release the space bar--it should only trigger once on key release.I tested this behavior using this codepen example on Firefox, Chrome, and Safari on Mac to be certain about it. Holding down space bar on the "real button" only triggers the click even on release, whereas holding down enter triggers it repeatedly until release. I added a "fake button" to demonstrate how this behavior can be replicated in JavaScript.
The text was updated successfully, but these errors were encountered: