#38992 closed defect (bug) (fixed)
Twenty Seventeen: Menu toggle doesn't work after adding a new menu item in customizer
Reported by: | ocean90 | Owned by: | davidakennedy |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | Bundled Theme | Keywords: | has-patch commit dev-reviewed |
Focuses: | javascript | Cc: |
Attachments (2)
Change History (11)
This ticket was mentioned in Slack in #core by helen. View the logs.
8 years ago
#4
@
8 years ago
About this line in navigation.js
:
$( siteNavigation.closest( '.main-navigation' ), this ).toggleClass( 'toggled-on' );
- not sure why
this
is passed as context, sincethis
is the clicked button - 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.
#5
@
8 years ago
- Keywords has-patch added; needs-patch removed
In 38992.patch, I applied @afercia's suggestion of simplifying the line $( siteNavigation.closest( '.main-navigation' ), this ).toggleClass( 'toggled-on' );
, which also appears to fix the reported issue with the menu toggle.
#6
@
8 years ago
- Keywords commit added
I tested this, and it works well and fixes the issue. Should be good to go.
@ocean90 it works in Twenty Sixteen without that JS snippet because Twenty Sixteen handles the dropdowns with pure CSS. There's no need to re-attach any event listeners.