appreciated/vaadin-app-layout

LeftNavigationItem Highlighting is triggered by unrelated Navigation

Opened this issue · 2 comments

Describe the bug
When you have a view that is not represented as a LeftNavigationItem in the LeftResponsiveHybrid menu and navigate to it by external means (such as a button or even typing the URL), then an apparently random LeftNavigationItem is highlighted.

To Reproduce
Steps to reproduce the behavior:

  1. Take one of the examples and add a TestView with route "test".
  2. Point your browser to "/test"

Expected behavior
None of the LeftNavigationItems should be highlighted.

** Additional Information (please complete the following information):**

  • OS: Linux
  • Browser: Firefox
  • Version: 70

A workaround is to add a LeftNavigationItem for the view and set it as invisible.

A workaround is to add a LeftNavigationItem for the view and set it as invisible.

If the view uses URL templates (Vaadin 14.5+) like @Route("/foo/:someId") this workaround does no longer work.

Constructing the LeftNavigationItem throws an exception with root cause: com.vaadin.flow.router.NotFoundException: No route found for the given navigation target and parameters!

So the only option right now is to not use URL templates for Views which are not represented as Navigation item 😢