Skip to content

NbMenu bug with HostListener #2761

Open
@RoWEN-FCUB

Description

@RoWEN-FCUB

Hello. I have a NbMenu that was working fine.

<nb-menu [items]="menu" tag="menu"></nb-menu>

Now I've added a HostListener in my app.component for user clicks detection and send a resfresh token request:

@HostListener('document:click', ['$event'])
  documentClick(event: MouseEvent) {
      // your click logic
      // console.log('clicked');
      this.authService.getToken().subscribe((token: NbAuthJWTToken) => {
        if (token) {
          if (!token.isValid()) {
             this.authService.logout('email');
          } else {
            this.authService.refreshToken('email', token).subscribe((result: NbAuthResult) => {});
          }
        }
      });
  }

Now my menu glitches. When I click on a collapsable menu it open and close again, not being able to click on the submenu items.

Thanks for any help.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions