fix(#676): prevent stuck sidebar branch tooltip (A+B+C)#678
Merged
Conversation
Tooltip was persistently visible after React concurrent re-renders lost the synthetic mouseleave, leaving `isTooltipVisible=true` stuck on the previously-hovered branch. - A: skip rendering the tooltip for the currently selected branch so a stale visibility flag does not linger on the focused item. - B: wrap the button onClick to explicitly reset `isTooltipVisible` to false before forwarding to the parent handler. - C: unmount the portal contents when not visible instead of keeping an empty tooltip node in the DOM; only attach aria-describedby while the tooltip is actually rendered so screen readers do not chase a dangling reference. Tests updated: existing tooltip-content assertions now fire mouseEnter first, and new tests cover initial-render absence, selected-branch absence, click-dismisses-tooltip, focus/blur lifecycle, and aria-describedby gating.
…eptance) Investigation, work-plan, TDD and acceptance artifacts for the sidebar tooltip stuck bug fix (A+B+C defensive guard). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
サイドバーのブランチ tooltip が
isTooltipVisible=trueのまま固着し、mouseleave/blur 後も画面に残り続ける不具合を、多層防御 (A+B+C) で修正します。Issue #675 の無限ループ中に React の mouseleave 合成イベントがレース状態に陥り state が落ちないケースに対する防御的修正です。Closes #676
Root cause
BranchListItem.tsxの tooltip は portal で DOM に常時存在し、opacity のみで表示制御していたため、setIsTooltipVisible(false)が dispatch されない瞬間に state が true で固定されるとユーザーから永久に残って見える構造でした。state を信頼しすぎない実装へ変更します。Changes
Fixed (A+B+C)
showTooltip = isTooltipVisible && !isSelectedでゲートhandleClickラッパーでsetIsTooltipVisible(false)後に props.onClick を呼ぶonMouseLeaveスキップに依存しない確実なトリガを追加isVisible=false時に portal の中身をnullにして DOM から物理除去useState→useEffect→ early return の順opacity: isVisible ? 1 : 0スタイルと「Always present in DOM」JSDoc を削除aria-describedbyは tooltip が実際に DOM に存在する時のみ button に付与(アクセシビリティ改善)Tests
mouseEnterを事前発火して tooltip 表示状態を明示)Sidebar.test.tsxの>=3を>=1に緩和(常時マウント前提だった暗黙の期待を修正)Files changed
src/components/sidebar/BranchListItem.tsxtests/unit/components/sidebar/BranchListItem.test.tsxtests/unit/components/layout/Sidebar.test.tsxdev-reports/bug-fix/issue676_20260424_201938/(investigation/work-plan/TDD/acceptance artifacts)Test Results
tsc --noEmit): 0 errorsBranchListItem.test.tsx: 45/45 passednpm run build): successAcceptance criteria
isVisible=falseのとき tooltip div が DOM に存在しないaria-describedbyは tooltip 実在時のみ付与Related
Checklist
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com