Skip to content

Commit daf2f50

Browse files
116404: Close modal on escape
(cherry picked from commit 84df67c)
1 parent eb93041 commit daf2f50

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/app/navbar/expandable-navbar-section/expandable-navbar-section.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,13 @@ export class ExpandableNavbarSectionComponent extends NavbarSectionComponent imp
166166
* @param event
167167
*/
168168
navigateDropdown(event: KeyboardEvent): void {
169-
if (event.key === 'Tab') {
169+
if (event.code === 'Tab') {
170170
this.deactivateSection(event, false);
171171
return;
172+
} else if (event.code === 'Escape') {
173+
this.deactivateSection(event, false);
174+
(document.querySelector(`a[aria-controls="${this.expandableNavbarSectionId()}"]`) as HTMLElement)?.focus();
175+
return;
172176
}
173177
event.preventDefault();
174178
event.stopPropagation();

0 commit comments

Comments
 (0)