Practice Site: Keyboard Accessible Tooltip Fail

While reading about keyboard input methods and learning about the success criteria requiring custom keyboard instructions for any custom key commands, one method of accomplishing this was using a tool tip to present the instructions. It mentioned that the tooltip would have to be accessible via keyboard navigation and be able to be read by a screen reader.

That reminded me that on my practice site, I spent a significant amount of time creating an example of success criteria for 3.1.3 to provide a definition of an unusual word when the user hovers over the text "affordance" displaying in a tooltip.

I did not, however, make this accessible to keyboard-only users or screen readers.

Screenshot of HTML code without keyboard or aria accessibility

Turns out it wasn't even focusable until I gave it a tab index.

More investigation into ARIA Practices for 3.24 Tooltip Widget call out specifically that the tooltip container requires role="tooltip" (which I did not have), and the element triggering the tooltip references the tooltip with aria-describedby (which I also did not have).

My plan to fix this was to make the tooltip text visible on focus instead of hover, and included the aria-describedby so it was read within context to the word itself.

Image of CSS showing focus used instead of hover

Screenshot of an active and visible focus state on the keyword, and a visible tooltip box


My first attempt was to change the div to a link, but the way the classes and other styles were already coded made that more difficult and would require a larger re-write.

This works now and I had a lot of fun to figure out.



Popular posts from this blog

Boiling the Ocean of Accessibility

Practice Site: Accessible Forms