[wp-trac] [WordPress Trac] #21562: Twenty Twelve: improve navigation to be mobile-first and not rely on JS for hiding and showing

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 23 19:32:48 UTC 2012


#21562: Twenty Twelve: improve navigation to be mobile-first and not rely on JS for
hiding and showing
---------------------------+------------------
 Reporter:  cfinke         |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  3.5
Component:  Bundled Theme  |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  has-patch      |
---------------------------+------------------

Comment (by azaozz):

 For the JS addClass and removeClass:

 {{{
 function removeClass(element, name) {
   element.className = element.className.replace( new
 RegExp('\\b'+name+'\\b', 'g'), '')
     .replace(/^ | $/, '').replace(/ +/g, ' '); // trim spaces
 }

 function addClass(element, name) {
   removeClass(element, name); // avoid duplicates
   element.className += ' ' + name;
 }
 }}}

 Perhaps consider making the menu fully accessible, instead of using
 `display: none` and `display: block`, much better to use `top: -10000em`
 to hide from the viewport but not from screen readers and `top: 0` to show
 (the submenus are already `position: absolute` anyway). Then use :focus as
 well as :hover to show them.

 This makes the sub-menus fully accessible when "tabbing" too. Changed that
 on the admin menu and it works a lot better now.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21562#comment:34>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list