react-bulma-components icon indicating copy to clipboard operation
react-bulma-components copied to clipboard

[a11y] Navbar.Link > Navbar.Dropdown can't be focused using the keyboard

Open FunctionDJ opened this issue 2 years ago • 0 comments

Describe the bug Title pretty much says it all. The Navbar.Dropdown component doesn't contain a <a> so it's not focuseable.

See official component viewer: https://couds.github.io/react-bulma-components/?path=/story/components-navbar--default

I've explored a few approaches between making the element focuseable using tabindex but then it still can't be triggered using the keyboard.

The correct solution would be to use the appropriate element for what the Navbar.Link should behave like: renderAs="button" This fixes basically all usability and accessibility issues, but unfortunately the browser default stylesheet bleeds through and makes the button look very ugly with a white background, border, changed font etc.

So instead of mopping that up with a lot more code i decided to use renderAs="a" with href="#" + event.preventDefault(). This is not ideal though. Optimally react-bulma-components would use a <button> in this case and apply the same styles and suppress the browser default styles.

It would be awesome if this component library can be made more accessible and keyboard friendly :)

FunctionDJ avatar Apr 02 '22 19:04 FunctionDJ