[wp-trac] [WordPress Trac] #38992: Twenty Seventeen: Menu toggle doesn't work after adding a new menu item in customizer

WordPress Trac noreply at wordpress.org
Wed Nov 30 23:07:23 UTC 2016


#38992: Twenty Seventeen: Menu toggle doesn't work after adding a new menu item in
customizer
---------------------------+-------------------------
 Reporter:  ocean90        |       Owner:
     Type:  defect (bug)   |      Status:  new
 Priority:  normal         |   Milestone:  4.7
Component:  Bundled Theme  |     Version:  trunk
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:  javascript
---------------------------+-------------------------

Comment (by afercia):

 About this line in `navigation.js`:

 {{{
 $( siteNavigation.closest( '.main-navigation' ), this ).toggleClass(
 'toggled-on' );
 }}}

 1. not sure why `this` is passed as context, since `this` is the clicked
 button
 2. I'd just declare and get the main navigation element earlier in the
 function

 Couple line below:

 {{{
 $( this )
         .add( siteNavigation )
         .attr( 'aria-expanded', $( this ).add( siteNavigation ).attr(
 'aria-expanded' ) === 'false' ? 'true' : 'false' );
 }}}

 I'm not sure there's the need to set `aria-expanded` also on the
 `siteNavigation`, that's the menu `<ul>` element that is not focusable or
 directly available to assistive technologies so `aria-expanded` seems a
 bit pointless to me.

 As a general consideration for `navigation.js`, not sure why there are two
 IIFEs nested within the main one.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38992#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list