css - accessibility menu - open menu on focus -


in site have menu , sub menu

my problem when focus tab menu, menu opened hovered menu mouse. when continued sub menu elements tab menu closed.

how can keep menu open if of sub element focused.

of course can via javascript, want know if can css only.

here example (try go links 'tab' )

li.main{        float:left;    width:200px;  }  li .sub{    display:none;    }  li:hover .sub{    display:block      }    li.main:focus .sub{     display:block      }
<ul>      <li class="main"  tabindex="0">      first menu      <div class='sub'>        <ul>          <li><a href="#">first link</a> </li>           <li><a href="#">second link</a> </li>          </ul>        </div>      </li> <li class="main"  tabindex="0">      second menu      <div class='sub'>        <ul>         <li><a href="#">third link</a> </li>           <li><a href="#">forth link</a> </li>          </ul>        </div>      </li>     </ul>

with current possibilities of css, can't, discussed in lot of questions before (see accessible css dropdown menu instance).

first of all, can't use "display:none" in such approach because link can't accessed using next link shortcut (tab key in of browsers implementation).

solutions work imply solutions positioning out of screen. restrict view on screen current link there no parent() selector in css, or might use trick in above thread (which work in browsers , limit width of dropdown part).

but no matter solution, not resolve main problem : a dropdown menu not best way achieve accessibility.

for instance, people disabilities using eye tracking software never benefit of dropdown menu. neither people using tablet.

it difficult use, difficult understand : if click on category link? open category main page, or open submenu?

if want accessible menu, not use dropdown menu


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -