I am working on a component that displays a button and a link when hovered over. This is not a conventional menu, but rather a box located in the center of the page.
Considering accessibility guidelines, I want users to be able to tab into the container, which currently reveals its content with the .HiddenUntilHover
class, and then continue tabbing to reach the button and link displayed during hover/focus state.
Presently, focusing on the container triggers the hover state; however, tabbing just moves to the next element without allowing access to the button or link WITHIN the hover state.
Here is a pseudo code example:
/* My component .jsx */
<div tabIndex="0" className="MainContainer">
<div className="SomeOtherClass">
<div className="HiddenUntilHover">
/* Tabbable clickable items */
<button>Click me!</button>
<a href="...">I am also clickable</a>
</div>
</div>
</div>
And here's my SCSS snippet:
.HiddenUntilHover {
display: none;
}
MainContainer:focus,
MainContainer:hover,
> .HiddenUntilHover {
display: block
}