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

refactor: replace slow performing CSS selectors #2968

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 2 additions & 11 deletions packages/components/src/components/navigation/navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,11 @@
}
}
}
}

&:has([aria-current="page"]),
> .db-navigation-item {
&[aria-current="page"] {
@extend %show-db-puls-auto;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This would certainly improve performance. Unfortunately, through this change NavigationItems are no longer marked as active if a nested NavigationItem has aria-current=“page”. From a11y point of view, we recommend that you only set aria-current=“page” to the anchor that points to the current page.

An alternative would be to use JS to set an “active” class from the innermost active NavigationItem to the outermost NavigationItem. But is that better than using the has-selector...?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think to remember that this wasn't even only about line 84 within the original file, but especially about the upfollowing 88 till 96, that even also provided a concatenated :has selector. I'll further investigate on this one.


menu {
// hide puls for non navigation items
:has([aria-current="page"]),
[aria-current="page"] {
&::after {
display: none;
}
}
}
}
}
}
Expand Down
Loading