Skip to content

Fix tab hover landing on the first tab - #257

Merged
lawrencecchen merged 2 commits into
mainfrom
fix-tab-hover-wrong-tab
Sep 28, 2026
Merged

lawrencecchen merged 2 commits into
mainfrom
fix-tab-hover-wrong-tab

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 28, 2026 •

Copy link
Copy Markdown

Regression from #253. With the pointer anywhere on the tab strip, the first tab showed the hover background and close button, and the tab under the pointer showed nothing.

`visibleFrames` used each tab hit-region view's `visibleRect`. Since macOS 14 `clipsToBounds` defaults to false, and `visibleRect` clips only at ancestors that clip, so for these views it returned the whole strip (600 pt wide for a 97 pt tab). Every tab's hover region covered the bar and the resolver picked the first tab. The fix intersects `visibleRect` with the view's `bounds`.

Commit 1 adds window-hosted tests that fail on main: hovering each tab's center must resolve to that tab, and a tab scrolled past the leading edge must have no hover region. Commit 2 is the fix. `swift test`: 230 tests pass.

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Fixes a regression from #253 where hovering anywhere on the tab strip highlighted the first tab instead of the one under the pointer. visibleFrames relied on each tab's visibleRect, which since macOS 14 spans the entire strip because clipsToBounds now defaults to false; the fix intersects that rect with the tab's own bounds.

Tests

  • Adds window-hosted tests: hovering each tab's center resolves to that tab, and a tab scrolled past the leading edge has no hover region.

Written for commit 7409ace. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Bug Fixes
    • Tab hover regions now match the portions of tabs that are actually visible. Tabs scrolled beyond the edge of the tab bar no longer respond to pointer positions outside the visible area, while visible tabs continue to respond correctly when hovered. This keeps hover feedback aligned with the tab’s on-screen position, including when the tab bar is scrolled.

lawrencecchen and others added 2 commits September 27, 2026 20:31
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Caution

Review failed

An error occurred during the review process. Please try again later.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 36425e48-c02e-47f8-b3ad-9fd1736a80ac

📥 Commits

Reviewing files that changed from the base of the PR and between fce65b5 and 7409ace.

📒 Files selected for processing (2)
  • Sources/Bonsplit/Internal/Views/TabBarItemGeometryRegistry.swift
  • Tests/BonsplitTests/TabBarLayoutFeedbackTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The tab geometry registry now intersects each tab’s visible rectangle with its bounds. New tests check hover resolution for unscrolled tabs and visible-frame clipping after scrolling.

Changes

Tab Hover Geometry

Layer / File(s) Summary
Constrain visible tab frames
Sources/Bonsplit/Internal/Views/TabBarItemGeometryRegistry.swift, Tests/BonsplitTests/TabBarLayoutFeedbackTests.swift
The registry intersects each tab’s visible rectangle with its bounds and skips null or empty results. Tests check hover resolution for unscrolled tabs and verify that frames stay within the clip after scrolling.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: austinywang

Merge Risk: ⚪ Minimal · up to 7409a

No outstanding issue is identified that would prevent merging the tab-hover fix after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: fixing incorrect hover resolution on the first tab. It is concise and directly related to the geometry fix and regression tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lawrencecchen
lawrencecchen merged commit 597a8bd into main Sep 28, 2026
6 checks passed
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.

1 participant