fix(renderer): stop git history hover from showing two tooltips (#14468)

Remove native title attributes from commit rows, subjects, and ref
badges so only the managed tooltip appears.
This commit is contained in:
Jinjing
2026-08-13 23:44:43 -07:00
committed by GitHub
parent fcd99fc032
commit 2e91a74deb
3 changed files with 33 additions and 10 deletions
@@ -76,4 +76,33 @@ describe('GitHistoryPanel', () => {
expect(markup).toContain('Fix tab overflow')
expect(markup).toContain('52ad492')
})
it('does not add native title tooltips alongside managed history tooltips', () => {
const result = makeHistoryResult()
result.items[0].references = [
{ id: 'refs/heads/main', name: 'main', category: 'branches' },
{ id: 'refs/heads/feature', name: 'feature', category: 'branches' },
{ id: 'refs/tags/v1.0.0', name: 'v1.0.0', category: 'tags' }
]
const markup = renderToStaticMarkup(
<GitHistoryPanel
state={{ status: 'ready', result }}
collapsed={false}
onToggle={vi.fn()}
onRefresh={vi.fn()}
onOpenCommit={vi.fn()}
/>
)
expect(markup).toContain('Fix tab overflow')
expect(markup).toContain('main')
expect(markup).toContain('feature')
expect(markup).toContain('+1')
expect(markup).not.toContain('title="Fix tab overflow"')
expect(markup).not.toContain('title="main"')
expect(markup).not.toContain('title="feature"')
expect(markup).not.toContain('title="v1.0.0"')
expect(markup).not.toMatch(/\stitle=/)
})
})
@@ -20,7 +20,6 @@ function GitHistoryRefBadge({ itemRef }: { itemRef: GitHistoryItemRef }): React.
borderColor: itemRef.color ? graphColor(itemRef.color) : 'var(--border)',
color: itemRef.color ? graphColor(itemRef.color) : 'var(--muted-foreground)'
}}
title={itemRef.name}
>
{itemRef.name}
</span>
@@ -90,9 +89,7 @@ export const GitHistoryRow = React.forwardRef<HTMLElement, GitHistoryRowProps>(
)}
<Tooltip>
<TooltipTrigger asChild>
<span className="block min-w-0 flex-1 truncate text-foreground" title={rowTooltip}>
{item.subject}
</span>
<span className="block min-w-0 flex-1 truncate text-foreground">{item.subject}</span>
</TooltipTrigger>
<TooltipContent
side="bottom"
@@ -112,10 +109,7 @@ export const GitHistoryRow = React.forwardRef<HTMLElement, GitHistoryRowProps>(
{hiddenRefs.length > 0 && (
<Tooltip>
<TooltipTrigger asChild>
<span
className="shrink-0 text-[10px] leading-none text-muted-foreground"
title={hiddenRefs.map((ref) => ref.name).join(', ')}
>
<span className="shrink-0 text-[10px] leading-none text-muted-foreground">
+{hiddenRefs.length}
</span>
</TooltipTrigger>
@@ -135,7 +129,6 @@ export const GitHistoryRow = React.forwardRef<HTMLElement, GitHistoryRowProps>(
{...rootProps}
ref={ref as React.Ref<HTMLDivElement>}
className={rowClassName}
title={rowTooltip}
data-testid="git-history-row"
>
{rowContent}
@@ -157,7 +150,6 @@ export const GitHistoryRow = React.forwardRef<HTMLElement, GitHistoryRowProps>(
ref={ref as React.Ref<HTMLButtonElement>}
type="button"
className={rowClassName}
title={rowTooltip}
aria-expanded={canExpand ? expanded : undefined}
aria-label={
canExpand
@@ -73,7 +73,9 @@ test('keeps conventional commit-message lines intact in the history tooltip', as
const row = orcaPage.getByTestId('git-history-row').filter({ hasText: subject })
await expect(row).toBeVisible({ timeout: 10_000 })
await expect(row).not.toHaveAttribute('title')
const trigger = row.locator('[data-slot="tooltip-trigger"]').filter({ hasText: subject })
await expect(trigger).not.toHaveAttribute('title')
await trigger.hover({ position: { x: 20, y: 10 } })
await trigger.hover({ position: { x: 40, y: 10 } })