Skip to content

frontend: prevent external-link extensions from showing as active in the sidebar#3859

Merged
patrickelectric merged 1 commit intobluerobotics:masterfrom
nicoschmdt:fix-multiple-items
Mar 30, 2026
Merged

frontend: prevent external-link extensions from showing as active in the sidebar#3859
patrickelectric merged 1 commit intobluerobotics:masterfrom
nicoschmdt:fix-multiple-items

Conversation

@nicoschmdt
Copy link
Copy Markdown
Contributor

@nicoschmdt nicoschmdt commented Mar 28, 2026

fix #2521

remove highlight/color if the item opens in a new tab (aka is a new_page)

Summary by Sourcery

Adjust sidebar navigation styling so external-link menu entries that open in a new tab are not shown as active.

Bug Fixes:

  • Prevent external-link sidebar items that open in a new tab from being highlighted as active.

Enhancements:

  • Introduce a dedicated CSS class and conditional color binding to distinguish external-link sidebar items from normal navigation entries.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 28, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts sidebar menu item styling so external-link (new_page) entries no longer appear as active/selected while still supporting opening in a new tab.

Flow diagram for sidebar menu item active styling and navigation

flowchart TD
  A[Start_sidebar_menu_item_render] --> B{menu_new_page}
  B -- true --> C[Set_v_list_item_group_color_to_undefined]
  B -- false --> D[Set_v_list_item_group_color_to_primary]

  C --> E[Add_CSS_class_external-link_to_v_list_item]
  D --> E

  E --> F{menu_new_page_or_menu_disabled}
  F -- true --> G[Set_to_null_prevent_router_navigation]
  F -- false --> H[Set_to_menu_route_for_router_navigation]

  E --> I{menu_new_page}
  I -- true --> J[Set_target_to__blank_open_in_new_tab]
  I -- false --> K[Set_target_to__self]

  E --> L{menu_extension_and_not_menu_disabled}
  L -- true --> M[Set_href_to_menu_route_anchor_behavior]
  L -- false --> N[Set_href_to_undefined]

  E --> O{v_list_item_has_class_external-link_and_is_active}
  O -- true --> P[Apply_CSS_rule_opacity_0_on_active_indicator]
  O -- false --> Q[Keep_default_active_indicator]

  P --> R[External_link_does_not_appear_selected]
  Q --> S[Internal_link_shows_active_highlight]

  R --> T[End]
  S --> T[End]
Loading

File-Level Changes

Change Details Files
Conditionally disable active color highlight for menu items that open in a new tab (external links).
  • Bind v-list-item-group color to be primary only when the current menu entry is not a new_page
  • Add a conditional CSS class to mark external-link menu items
  • Override Vuetify active-state pseudo-element for external-link items so the active background/indicator is hidden
core/frontend/src/App.vue

Assessment against linked issues

Issue Objective Addressed Explanation
#2521 Prevent sidebar extension items that open in a new tab (new_page/external-link items) from appearing as active, so that multiple sidebar items do not show as active at once.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Instead of relying on a custom .external-link class plus a global CSS rule with !important, consider using Vuetify’s active-class/exact-active-class props (or :ripple="false" and related options) on the list item to disable the active styling for menu.new_page items in a more idiomatic way.
  • The :color="menu.new_page ? undefined : 'primary'" binding on v-list-item-group changes the group’s behavior based on each menu, so it’s worth confirming that this doesn’t inadvertently affect other items in the same group (you may want to handle the visual state per-item rather than on the group if multiple item types co-exist).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Instead of relying on a custom `.external-link` class plus a global CSS rule with `!important`, consider using Vuetify’s `active-class`/`exact-active-class` props (or `:ripple="false"` and related options) on the list item to disable the active styling for `menu.new_page` items in a more idiomatic way.
- The `:color="menu.new_page ? undefined : 'primary'"` binding on `v-list-item-group` changes the group’s behavior based on each menu, so it’s worth confirming that this doesn’t inadvertently affect other items in the same group (you may want to handle the visual state per-item rather than on the group if multiple item types co-exist).

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@patrickelectric patrickelectric merged commit 29fc497 into bluerobotics:master Mar 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Frontend: multiple items (extension only?) show as active at once

2 participants