Repository navigation
fix(nav-rail): hide tooltip that repeats a visible label (CORE-2785) - #512
Open
yamamporiya wants to merge 1 commit into
Open
yamamporiya wants to merge 1 commit into
yamamporiya wants to merge 1 commit into
Conversation
ispashkov
requested changes
Nov 18, 2026
ispashkov
left a comment
Collaborator
There was a problem hiding this comment.
Problem. disabled on Tooltip changes with mode. Say the pointer is resting on an item and the rail goes collapsed → expanded → collapsed. After that, the tooltip on that item never opens again. While disabled is set, zag ignores pointerleave, so its internal hasPointerMoveOpened flag never resets (see the comment in Tooltip.tsx:71). I reproduced this with a test. Swapping disabled for open={false} doesn't fix it. Lint is also failing on formatting.
Fix (verified: the repro and all NavRail tests pass). Don't mount Tooltip when there's nothing to show:
const hasShortcut = !!shortcut?.length;
const trigger = props['aria-haspopup'] ? <span className='flex flex-1'>{element}</span> : element;
// A visible label without a shortcut leaves the tooltip nothing to add.
if (showsLabel && !hasShortcut) return trigger;
return (
<Tooltip positioning={{ placement: 'right' }}>
<TooltipTrigger asChild>{trigger}</TooltipTrigger>
<TooltipContent>
{!showsLabel && label}
{!showsLabel && hasShortcut && ' '}
{shortcut?.map((key, index) => (
<Fragment key={key}>
{index > 0 && ' then '}
<Kbd size='small'>{key}</Kbd>
</Fragment>
))}
</TooltipContent>
</Tooltip>
);Also:
- Add tests to
NavRail.test.tsx:expandedwithout a shortcut: no tooltip;expandedwith a shortcut:Kbdonly;collapsed: label and shortcut;compact+avatar: the user's name;- regression: change
modewhile hovered, then the tooltip still opens.
- Run
pnpm lint:fix. - Rename the PR to
fix(nav-rail): hide tooltip that repeats a visible label (CORE-2785).
yamamporiya
force-pushed
the
feat/CORE-2785
branch
from
November 19, 2026 06:01
3efe98b to
c19ca5b
Compare
Contributor
|
This PR is included in version 4.20.2-rc-feat-CORE-2785.1 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Related Tickets & Documents
https://wallarm.atlassian.net/browse/CORE-2785