feat(core): keyboard accessibility support (on by default)
mrlubos opened this issue · 7 comments
Hello, I think it would be great if this button was accessible using the keyboard. This can be achieved by adding tabindex="0"
and role="button"
to the wrapper <div>
tag that has click listener attached to it.
Love the idea, thanks for reporting! It would be cool to enable/disable that as well.
Open to a PR if you get a chance, otherwise, I will try to get to it this week.
@prescottprue Yes definitely, users shouldn’t be able to focus this button if it’s disabled imo. Btw why doesn’t it use as a wrapper?
Not sure what you mean by "why doesn't it use as a wrapper" - guessing you mean something why not support using it as a Higher Order Component wrapper? If so, the answer is just that I haven't needed it yet, but totally open to the idea.
We could instead do a component prop similar to how material-ui does their button, it may be more clear than an HOC.
@prescottprue Aha! Formatting removed a word, it was meant to be “why doesn’t it use <button>
as a wrapper,” so children elements would be enclosed inside. Sorry!
Hi @prescottprue, did you have time to look into this? Thanks!
@lmenus totally forgot about this, thanks for the reminder. v0.6.0-alpha
was released to the next
tag (and branch) with tabIndex
set to 0
and role="button"
.
Let me know if it doesn't work as you expect, and we can change it before it goes out to latest
.
Was going to look into a few more changes before releasing v0.6.0
to latest
, but it should be pretty soon.
Hi @prescottprue, sorry for the late reply. Tested it now and works great, thank you!