File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
modules/localgov_subsites_paragraphs/js Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 247247 // Trigger create/destroy functions at different screen widths
248248 // based on the value of data-accordion-tabs-switch attribute.
249249 if ( window . matchMedia ) {
250- mq . addListener ( ( ) => {
250+ mq . addEventListener ( "change" , ( ) => {
251251 breakpointCheck ( ) ;
252252 } ) ;
253253 breakpointCheck ( ) ;
Original file line number Diff line number Diff line change 8080 tab . addEventListener ( 'keydown' , e => {
8181 let newActiveControl ;
8282
83- switch ( e . which ) {
84- case 37 :
83+ switch ( e . key ) {
84+ case 'ArrowLeft' :
8585 // Left arrow. If there's a previous element, switch to it.
8686 if ( i - 1 >= 0 ) {
8787 newActiveControl = tabList
9494 newActiveControl [ 0 ] . focus ( ) ;
9595 }
9696 break ;
97- case 39 :
97+ case 'ArrowRight' :
9898 // Right arrow. If there's a next element, switch to it.
9999 if ( i + 1 < tabPanelsNumber ) {
100100 newActiveControl = tabList
107107 newActiveControl [ 0 ] . focus ( ) ;
108108 }
109109 break ;
110- case 40 :
110+ case 'ArrowDown' :
111111 // Arrow down. Move focus into the active panel.
112112 tabPanels [ i ] . focus ( ) ;
113113 break ;
177177 // Trigger create/destroy functions at different screen widths
178178 // based on the value of data-accordion-tabs-switch attribute.
179179 if ( window . matchMedia ) {
180- mq . addListener ( ( ) => {
180+ mq . addEventListener ( "change" , ( ) => {
181181 breakpointCheck ( ) ;
182182 } ) ;
183183 breakpointCheck ( ) ;
Original file line number Diff line number Diff line change 8989 tab . addEventListener ( 'keydown' , function ( e ) {
9090 var newActiveControl = void 0 ;
9191
92- switch ( e . which ) {
93- case 37 :
92+ switch ( e . key ) {
93+ case 'ArrowLeft' :
9494 // Left arrow. If there's a previous element, switch to it.
9595 if ( i - 1 >= 0 ) {
9696 newActiveControl = tabList . querySelectorAll ( 'li' ) [ i - 1 ] . querySelectorAll ( 'button' ) ;
9797 Drupal . behaviors . localgovTabs . switchTab ( newActiveControl [ 0 ] , tabs ) ;
9898 newActiveControl [ 0 ] . focus ( ) ;
9999 }
100100 break ;
101- case 39 :
101+ case 'ArrowRight' :
102102 // Right arrow. If there's a next element, switch to it.
103103 if ( i + 1 < tabPanelsNumber ) {
104104 newActiveControl = tabList . querySelectorAll ( 'li' ) [ i + 1 ] . querySelectorAll ( 'button' ) ;
105105 Drupal . behaviors . localgovTabs . switchTab ( newActiveControl [ 0 ] , tabs ) ;
106106 newActiveControl [ 0 ] . focus ( ) ;
107107 }
108108 break ;
109- case 40 :
109+ case 'ArrowDown' :
110110 // Arrow down. Move focus into the active panel.
111111 tabPanels [ i ] . focus ( ) ;
112112 break ;
179179 // Trigger create/destroy functions at different screen widths
180180 // based on the value of data-accordion-tabs-switch attribute.
181181 if ( window . matchMedia ) {
182- mq . addListener ( function ( ) {
182+ mq . addEventListener ( "change" , ( ) => {
183183 breakpointCheck ( ) ;
184184 } ) ;
185185 breakpointCheck ( ) ;
You can’t perform that action at this time.
0 commit comments