-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiBasicTable] Trigger onClick
on keypress
not keyup
#4685
Comments
Yeah, the component definitely has ways that it could be improved but with such a broad charge as making accessible whatever it wrapped, it ultimately is next-to-impossible to make accessible for all cases and was often misused making matters worse. Because of that, we deprecated It sounds like it would be best to migrate your case to using a native browser If you think there's a missing feature for EUI to cover that you're using |
My "fake button" is actually a |
++ for sure, this would be good to shim in |
onClick
on keypress
not keyup
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment. |
❌ We're automatically closing this issue due to lack of activity. Please comment if you feel this was done in error. |
The
EuiKeyboardAccessible
currently triggers theonClick
when Enter or Space is pressed in theonKeyUp
method. I think this should rather happen in theonKeyPress
instead to be aligned with browser behavior.Browser will trigger button clicks after the keypress, and thus also properly work with repeating key events, i.e. having a
button
focused and keep pressing Enter will result in the following event order:I think we should align the
EuiKeyboardAccessible
to also trigger the click on keypress not on keydown to (a) align with the standard browser behavior and (b) the current implementation can cause some very unnice side-effects, since the browser is triggering still on keypress. The way I run currently into that problem is:I have a regular button that is on click closing a flyout. After that closing the last element on the page will regain it's focus: it was the "fake button" (something wrapped in
EuiKeyboardAccessible
) that opened the flyout. Since the click is triggered before the keyup, the "fake button" will now receive the keyup and trigger the click on it, directly reopening the flyout. The only way to currently work around that is to prevent all your real buttons that might run into that problem from triggerig their click on keypress, and instead manually trigger click on keyup (i.e. changing the browser's default behavior). I think thus we should consider aligning better to the browser behavior and trigger onClick on keyup.I am not sure if there might be edge-cases I am overseing that this would cause a problem, thus I wanted to put this issue up to see if there are any concerns around it.
cc @chandlerprall @myasonik
The text was updated successfully, but these errors were encountered: