Skip to content

chore(code): add tooltip to branch selector#1937

Merged
VojtechBartos merged 1 commit intomainfrom
posthog-code/add-tool-tip-to-branch-selector
Apr 29, 2026
Merged

chore(code): add tooltip to branch selector#1937
VojtechBartos merged 1 commit intomainfrom
posthog-code/add-tool-tip-to-branch-selector

Conversation

@VojtechBartos
Copy link
Copy Markdown
Member

@VojtechBartos VojtechBartos commented Apr 29, 2026

Summary

Replaces the native title attribute on the top-bar branch selector button with the styled Tooltip component already used elsewhere in the app (e.g. DiffStatsBadge, ReviewToolbar). Applies to both HeaderRow and TaskInput usages of BranchSelector.

The tooltip opens on mouse hover only — focus no longer triggers it, so it doesn't pop back up after the combobox is dismissed. It's also suppressed while the dropdown is open or while loading.

Shocase

Screenshot 2026-04-29 at 11 30 38

Created with PostHog Code

@VojtechBartos VojtechBartos self-assigned this Apr 29, 2026
@VojtechBartos VojtechBartos requested a review from a team April 29, 2026 10:03
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 29, 2026

Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx
Line: 179-190

Comment:
**Stale `hovered` state when button becomes disabled**

When the button transitions to `disabled` while the cursor is already over it, `onMouseLeave` may not fire (disabled elements don't reliably receive pointer events in browsers), leaving `hovered` stuck as `true`. Once loading finishes — flipping `effectiveLoading` to `false` — the condition `hovered && !open && !effectiveLoading` becomes truthy even though the cursor has since moved away, causing the tooltip to appear unexpectedly.

Resetting `hovered` whenever `isDisabled` flips to `true` would guard against this:

```tsx
useEffect(() => {
    if (isDisabled) setHovered(false);
}, [isDisabled]);
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "chore(code): add tooltip to branch selec..." | Re-trigger Greptile

Comment on lines +179 to +190
open={hovered && !open && !effectiveLoading}
>
<ComboboxTrigger
render={
<Button
ref={localAnchorRef}
variant="outline"
size="sm"
disabled={isDisabled}
aria-label="Branch"
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Stale hovered state when button becomes disabled

When the button transitions to disabled while the cursor is already over it, onMouseLeave may not fire (disabled elements don't reliably receive pointer events in browsers), leaving hovered stuck as true. Once loading finishes — flipping effectiveLoading to false — the condition hovered && !open && !effectiveLoading becomes truthy even though the cursor has since moved away, causing the tooltip to appear unexpectedly.

Resetting hovered whenever isDisabled flips to true would guard against this:

useEffect(() => {
    if (isDisabled) setHovered(false);
}, [isDisabled]);
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/git-interaction/components/BranchSelector.tsx
Line: 179-190

Comment:
**Stale `hovered` state when button becomes disabled**

When the button transitions to `disabled` while the cursor is already over it, `onMouseLeave` may not fire (disabled elements don't reliably receive pointer events in browsers), leaving `hovered` stuck as `true`. Once loading finishes — flipping `effectiveLoading` to `false` — the condition `hovered && !open && !effectiveLoading` becomes truthy even though the cursor has since moved away, causing the tooltip to appear unexpectedly.

Resetting `hovered` whenever `isDisabled` flips to `true` would guard against this:

```tsx
useEffect(() => {
    if (isDisabled) setHovered(false);
}, [isDisabled]);
```

How can I resolve this? If you propose a fix, please make it concise.

Replace the native title attribute on the branch selector button with the
styled Tooltip component so it matches the rest of the top-bar UI. Tooltip
opens on mouse hover only and is suppressed while the dropdown is open or
loading.

Generated-By: PostHog Code
Task-Id: b6750e3b-b69f-48a6-bc2d-124ba5642eb9
@VojtechBartos VojtechBartos force-pushed the posthog-code/add-tool-tip-to-branch-selector branch from 48b1c2f to 9f71eb1 Compare April 29, 2026 10:05
@VojtechBartos VojtechBartos enabled auto-merge (squash) April 29, 2026 10:07
@VojtechBartos VojtechBartos merged commit 466fcc4 into main Apr 29, 2026
14 of 15 checks passed
@VojtechBartos VojtechBartos deleted the posthog-code/add-tool-tip-to-branch-selector branch April 29, 2026 10:15
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