Skip to content

Commit

Permalink
Handle undefined drawer
Browse files Browse the repository at this point in the history
  • Loading branch information
PatelUtkarsh committed May 14, 2022
1 parent db63f5d commit 1eb7cf7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions theme/assets/src/front-end/components/drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ export const drawerInit = () => {
drawerElement.querySelector( '.mdc-list' ) ??
drawerElement.querySelector( '.wp-block-page-list' );

listElement.addEventListener( 'click', () => {
drawer.open = false;
} );
if ( listElement ) {
listElement.addEventListener( 'click', () => {
drawer.open = false;
} );
}

const firstElement =
listElement.querySelector( '.mdc-list-item' ) ??
Expand Down

0 comments on commit 1eb7cf7

Please sign in to comment.