From 2e91a74debba4ffbb942b9d8a4d728f9aa001234 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Thu, 13 Aug 2026 23:44:43 -0700 Subject: [PATCH] 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. --- .../right-sidebar/GitHistoryPanel.test.tsx | 29 +++++++++++++++++++ .../right-sidebar/GitHistoryRow.tsx | 12 ++------ tests/e2e/git-history-tooltip-wrap.spec.ts | 2 ++ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx b/src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx index 07129f53077..33fc4565527 100644 --- a/src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx +++ b/src/renderer/src/components/right-sidebar/GitHistoryPanel.test.tsx @@ -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( + + ) + + 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=/) + }) }) diff --git a/src/renderer/src/components/right-sidebar/GitHistoryRow.tsx b/src/renderer/src/components/right-sidebar/GitHistoryRow.tsx index f41ea2f92b4..f2c3f020178 100644 --- a/src/renderer/src/components/right-sidebar/GitHistoryRow.tsx +++ b/src/renderer/src/components/right-sidebar/GitHistoryRow.tsx @@ -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} @@ -90,9 +89,7 @@ export const GitHistoryRow = React.forwardRef( )} - - {item.subject} - + {item.subject} ( {hiddenRefs.length > 0 && ( - ref.name).join(', ')} - > + +{hiddenRefs.length} @@ -135,7 +129,6 @@ export const GitHistoryRow = React.forwardRef( {...rootProps} ref={ref as React.Ref} className={rowClassName} - title={rowTooltip} data-testid="git-history-row" > {rowContent} @@ -157,7 +150,6 @@ export const GitHistoryRow = React.forwardRef( ref={ref as React.Ref} type="button" className={rowClassName} - title={rowTooltip} aria-expanded={canExpand ? expanded : undefined} aria-label={ canExpand diff --git a/tests/e2e/git-history-tooltip-wrap.spec.ts b/tests/e2e/git-history-tooltip-wrap.spec.ts index 6a8c4f5895b..f2f0fa50b36 100644 --- a/tests/e2e/git-history-tooltip-wrap.spec.ts +++ b/tests/e2e/git-history-tooltip-wrap.spec.ts @@ -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 } })