fix(ui): fix Header nav hover indicator covering tab text#33696
fix(ui): fix Header nav hover indicator covering tab text#33696
Conversation
Add `position: relative` and `z-index: 2` to nav items so they paint above the hover/active indicator, matching the Tabs pattern. This fixes themes with opaque `--bui-bg-neutral-2` values obscuring tab labels on hover. Also fix `--bui-font-family` (non-existent) to `--bui-font-regular`. Signed-off-by: Johan Persson <johanopersson@gmail.com>
Changed Packages
|
| text-decoration: none; | ||
| cursor: pointer; | ||
| position: relative; | ||
| z-index: 2; |
There was a problem hiding this comment.
Definitely needed? 🤔, thinking if we could reorder elements or smth instead
There was a problem hiding this comment.
The indicator is absolute positioned, so reordering won't be enough. It actually works as-is out of the box in Backstage, but some themes might set a non-transparent neutral color, which would cause issues. This fix was/is actually already in the Tabs component, I removed it when I created this one because I thought it would be enough without. :)
There was a problem hiding this comment.
Pull request overview
Fixes HeaderNav hover/active indicator layering so the (absolutely positioned) hover background no longer paints over tab text when themes use an opaque --bui-bg-neutral-2. Also corrects the HeaderNav font token to use the existing --bui-font-regular variable.
Changes:
- Add
position: relative+z-index: 2to Header nav items/groups so labels render above the hover indicator (matching theTabspattern). - Replace non-existent
--bui-font-familytoken usage with--bui-font-regular. - Add a patch changeset documenting the fix for
@backstage/ui.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/ui/src/components/Header/HeaderNav.module.css | Adjusts stacking order so tab text renders above hover indicator; fixes font token reference. |
| .changeset/wicked-impalas-fry.md | Adds a patch changeset describing the Header hover indicator fix and token correction. |
🎨 Visual Testing with Chromatic
|
|
Thank you for contributing to Backstage! The changes in this pull request will be part of the |
Hey, I just made a Pull Request!
The
HeaderNavhover indicator usesposition: absoluteand paintson top of tab text. This works with the default BUI theme because
--bui-bg-neutral-2is semi-transparent, but any theme using anopaque value for that token fully obscures the tab labels on hover.
This adds
position: relativeandz-index: 2to nav items (matchingthe
Tabscomponent pattern) so they paint above the indicators.Also fixes a reference to the non-existent
--bui-font-familyCSSvariable — the correct token is
--bui-font-regular.✔️ Checklist
Signed-off-byline in the message.