Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Header: not updating current selection when using routerLink #1772

Closed
DarylChiew opened this issue Apr 11, 2024 · 3 comments · Fixed by #1843
Closed

App Header: not updating current selection when using routerLink #1772

DarylChiew opened this issue Apr 11, 2024 · 3 comments · Fixed by #1843
Assignees
Labels
Bug Something isn't working

Comments

@DarylChiew
Copy link

DarylChiew commented Apr 11, 2024

Describe the bug

When using routerLink, the blue line above the currently selected item does not get updated when a new item is clicked. This same behaviour can also be seen if you use a click event on an a tag instead of the standard href.

I am using web-components v1.20.2 and angular-components v3.0.2.

Provide Code

<goa-microsite-header [type]="stage" [version]="environment" />
<div class="parent-container">
  <div style="max-width: var(--header-width-max); margin: 0 auto;">
    <goa-app-header heading="{{ title }}" url="/">
      <a routerLink="/">Home</a>
        <goa-app-header-menu heading="Services">
          <a routerLink="/">Title</a>
          <a routerLink="/">Volume Data Agreement</a>
        </goa-app-header-menu>
      <a routerLink="/">Contact Us</a>
      <a *ngIf="(isLoggedIn$ | async) === false" (click)="signInLocal($event)">Sign In</a>
    </goa-app-header>
  </div>
</div>
signInLocal(event: any) {
  this.router.navigateByUrl('/', { state });
}

To Reproduce

You may need to update the links in the above code to point to actual locations in your testing app.

With the code provided, click on the "Contact us" link and notice that the indicator doesn't change. Clicking on any of the other items exhibit the same behaviour.

Note that refreshing the page does update the indicator.

What browsers are you seeing the problem on?

Chrome, Edge

Additional context

Changing the attribute from routerLink to href allows the indicator to update on click, but in angular, this will cause the entire page to refresh. This is also seen on our website, using React, so not an Angular only issue, and not necessarily related to routerLink

Additionally, for mobile resolutions, when clicking the Sign In button in the expanded Menu, the drop down doesn't automatically collapse after clicking. It takes me to the page, but the menu stays expanded

@DarylChiew DarylChiew added the Bug Something isn't working label Apr 11, 2024
@ArakTaiRoth
Copy link
Collaborator

Potentially related to #1792 , test both when testing this story

@ArakTaiRoth
Copy link
Collaborator

Also related to #1386

@vanessatran-ddi
Copy link
Collaborator

It is similar to the bug #1386

@vanessatran-ddi vanessatran-ddi self-assigned this May 7, 2024
vanessatran-ddi added a commit to vanessatran-ddi/ui-components that referenced this issue May 7, 2024
@vanessatran-ddi vanessatran-ddi linked a pull request May 7, 2024 that will close this issue
@ArakTaiRoth ArakTaiRoth changed the title [Bug]: AppHeader not updating current selection when using routerLink App Header: not updating current selection when using routerLink May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
Archived in project
3 participants