Reputation: 1009
I've grid with several boxes in (<div>
). Each box has inside a list with couple/ several links (simple ul li
list with <a>
elements). This link list is hidden, it shows only on hover.
It works really fine, but I have accessibility issue, namely, I can't get into any list element with "tab" key (box <div>
works ok, it get focus, so the list is showing up), it is just skipping to next box element. I've tried with adding tabindex
on each box and each list element inside, but it seems that this is not the solution.
Is there any CSS/ HTML solution for that? I can of course write simple JS, that will check where is focus and if focus has parent with focus option, but I would like to avoid it if possible.
Upvotes: 0
Views: 1127
Reputation: 2707
display: none
or using visibility: hidden
. (And that you apply this only to the list elements or also to the div? From your description, I guess it applies only to the list elements.) Content that is hidden using display: none
is not keyboard accessible.onfocus
, but as mentioned above, content hidden with display: none
won't receive focus). In CSS, I always recommend adding the :focus
pseudo-class whenever :hover
is used (unless you want different styles for these things). div
receives focus. (If you have tabindex
on the div
elements, as you say, they should already be able to receive focus.)Upvotes: 1