Skip to content

Commit

Permalink
116404: Close modal on escape
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrevryghem committed Jul 5, 2024
1 parent 2c86f59 commit 74d920d
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,13 @@ export class ExpandableNavbarSectionComponent extends NavbarSectionComponent imp
* @param event
*/
navigateDropdown(event: KeyboardEvent): void {
if (event.key === 'Tab') {
if (event.code === 'Tab') {
this.deactivateSection(event, false);
return;
} else if (event.code === 'Escape') {
this.deactivateSection(event, false);
(document.querySelector(`a[aria-controls="${this.expandableNavbarSectionId()}"]`) as HTMLElement)?.focus();
return;
}
event.preventDefault();
event.stopPropagation();
Expand Down

0 comments on commit 74d920d

Please sign in to comment.