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

Only highlight main nav items on exact match. #4401

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

jrobbins
Copy link
Collaborator

This avoids the possibility of both "All features" and "Shipping 2024" main menu items both being highlighted at the same time. It also means that the "All features" item will not be highlighted if the user specifies a search term, but that is arguably correct since they are no longer looking at all features.

Copy link
Collaborator

@jcscottiii jcscottiii left a comment

Choose a reason for hiding this comment

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

LGTM. I had one thought for the future

@@ -231,7 +231,7 @@ export class ChromedashDrawer extends LitElement {
}

isCurrentPage(href) {
return this.currentPage.startsWith(href);
return this.currentPage === href;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Something to consider in the future: I think all of the urls on the menu have 0 or 1 query parameters now so it doesn't matter. But if that number grows, we will need to parse the urls and then sort the query string parameters before comparing.

This will help in case a user types in the URL directly into the browser but with the query parameters out of order.

@jrobbins jrobbins merged commit 92b37fe into main Sep 27, 2024
7 checks passed
@jrobbins jrobbins deleted the 20240927-only-highlight-nav-items-on-exact-match branch September 27, 2024 18:38
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.

2 participants