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 Aug 5, 2024
1 parent 535bff9 commit b4023c1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,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 b4023c1

Please sign in to comment.