File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5656 * Toggles active class on the primary nav panel
5757 * 1) Select all nav triggers and cycle through them
5858 * 2) On click, find the nav panel within the header
59- * 3) If the navPanel already has active class, remove it on click.
60- * 4) If the navPanel does not have an active class, add it on click.
59+ * 3) If the navPanel already has active class, remove it on click, as well as the aria-expanded attributes value .
60+ * 4) If the navPanel does not have an active class, add it on click, as well as the aria-expanded attributes value .
6161 */
6262 var navToggle = document . querySelectorAll ( '.js-nav-trigger' ) ; /* 1 */
6363
6767 navToggle [ i ] . addEventListener ( 'click' , function ( event ) {
6868 /* 2 */
6969 event . preventDefault ( ) ;
70- var navToggleParent = this . parentNode ; /* 2 */
70+ var navToggleElement = this ;
71+ var navToggleParent = navToggleElement . parentNode ; /* 2 */
7172 var navPanel = navToggleParent . querySelector ( '.js-nav-panel' ) ; /* 2 */
7273
7374 if ( navPanel . classList . contains ( 'is-active' ) ) {
7475 /* 3 */
7576 navPanel . classList . remove ( 'is-active' ) ;
77+ navToggleElement . setAttribute ( 'aria-expanded' , 'false' ) ;
7678 } else {
7779 /* 4 */
7880 navPanel . classList . add ( 'is-active' ) ;
81+ navToggleElement . setAttribute ( 'aria-expanded' , 'true' ) ;
7982 }
8083 } ) ;
8184 }
Original file line number Diff line number Diff line change 4747.c-header__nav-btn {
4848 margin-left : auto ;
4949
50+ // Pseudo / breakout element that enables clicking/tabbing outside of the menu to close it
51+ & [aria-expanded = " true" ]::after {
52+ position : fixed ;
53+ top : 0 ;
54+ left : 0 ;
55+
56+ content : " " ;
57+
58+ width : 100vw ;
59+ height : 100vh ;
60+ }
61+
5062 @media all and (min-width : $bp-large ) {
5163 display : none ;
5264 }
You can’t perform that action at this time.
0 commit comments