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

Tag onClick does not fire with spacebar or enter press when focused #4782

Closed
evansjohnson opened this issue Jun 25, 2021 · 2 comments · Fixed by #7060
Closed

Tag onClick does not fire with spacebar or enter press when focused #4782

evansjohnson opened this issue Jun 25, 2021 · 2 comments · Fixed by #7060

Comments

@evansjohnson
Copy link
Contributor

Code Sandbox

https://codesandbox.io/s/palantir-blueprint-forked-s0reo

Steps to reproduce

  1. click tag, observe onClick handler works
  2. use tab to navigate to tag, onClick does not fire with spacebar or enter

Button included to show expected behavior

Actual behavior

onClick of Tag does not fire with spacebar or enter press when focused

Expected behavior

spacebar/enter should trigger onClick of Tag

Possible solution

if Tag has onClick defined, render as a button but with the Tag styles

@adidahiya
Copy link
Contributor

adidahiya commented Jun 30, 2021

I'm not sure this is expected behavior for tags. If you really want something so interactive that it can be focussed and clicked via the keyboard, you probably want a minimal or outlined button instead. I don't think your requested feature exists in other design toolkits like Bootstrap or Ant (tags are not even focussable by default in Ant).

@evansjohnson
Copy link
Contributor Author

I'm not sure this is expected behavior for tags. If you really want something so interactive that it can be focussed and clicked via the keyboard, you probably want a minimal or outlined button instead. I don't think your requested feature exists in other design toolkits like Bootstrap or Ant (tags are not even focussable by default in Ant).

"so interactive that ..." seems to indicate levels of interactivity, I think it's a binary thing. Either an element is interactive and it should be accessible by keyboard users, or it's not interactive and doesn't need to receive focus/be triggered by keyboard.

I'd support Tags not accepting the onClick prop/no interactive style but that sounds like a large breaking change, but don't think that's a reason for Tags to stay in a state of partial support for interactivity.

I don't need an immediate solution but thought raising this would be helpful to track accessibility of Blueprint components, particularly if the issue sees other activity. Perhaps a "Domain: accessibility" label is appropriate here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants