116404: Close modal on escape

This commit is contained in:
Alexandre Vryghem
2024-07-05 17:57:18 +02:00
parent 2152bab717
commit 84df67c00b

View File

@@ -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();