Skip to content

Commit

Permalink
feature: CRMMON-8111 listen to enter in dropdown menu without inputs (#…
Browse files Browse the repository at this point in the history
…239)

Signed-off-by: Anna Artamonova <tesess@gmail.com>
  • Loading branch information
mt-anna authored Feb 4, 2025
1 parent 9c65d70 commit e760bd6
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ export class BaoDropdownMenuItem implements AfterViewInit, OnChanges {
@HostListener('window:keyup.enter')
enterKeyEvent() {
if (document.activeElement == this.nativeElement) {
if (this.nativeElement.attributes['href']) {
this._parent.setNavigationAttribute(this.nativeElement);
}
this.propagateClick();
this.nativeElement.click();
}
}

Expand Down Expand Up @@ -451,6 +448,7 @@ export class BaoDropdownMenuTrigger implements AfterViewInit, OnDestroy {
@Input('baoDropdownMenuTriggerFor') menu: BaoDropdownMenuComponent | null;
private _overlayRef: OverlayRef | null = null;
private _isMenuOpen = false;
private animationDelay = 50;

constructor(
private renderer: Renderer2,
Expand Down Expand Up @@ -484,7 +482,7 @@ export class BaoDropdownMenuTrigger implements AfterViewInit, OnDestroy {
);
this.menu.isClosedByKeyEvent.subscribe(() => {
this.closeMenu();
setTimeout(() => this.nativeElement.focus(), 50);
setTimeout(() => this.nativeElement.focus(), this.animationDelay);
});
}

Expand Down Expand Up @@ -514,7 +512,7 @@ export class BaoDropdownMenuTrigger implements AfterViewInit, OnDestroy {
overlayRef.attach(this.menu.menuPortal);
this._isMenuOpen = true;
this.menu.open();
this.menu.focus();
setTimeout(() => this.menu.focus(), this.animationDelay);
}

private createOverlay(): OverlayRef {
Expand Down

0 comments on commit e760bd6

Please sign in to comment.