Skip to content

fix(hig): show the resize cursor over SwiftUI-hosted split dividers#1908

Merged
datlechin merged 2 commits into
mainfrom
fix/1905-split-divider-resize-cursor
Jul 18, 2026
Merged

fix(hig): show the resize cursor over SwiftUI-hosted split dividers#1908
datlechin merged 2 commits into
mainfrom
fix/1905-split-divider-resize-cursor

Conversation

@datlechin

Copy link
Copy Markdown
Member

Fixes #1905.

Problem

The split divider on the Users and Roles tab drags to resize but never changes the pointer to the resize cursor, so it does not look draggable.

AppKit's automatic divider cursor rides on the classic cursor-rects system, which does not fire once an NSSplitView is mounted inside an NSHostingController. Every tab-content split is hosted that way, several SwiftUI layers deep under MainSplitViewController.detailHosting. The window's own sidebar and inspector dividers show the cursor only because MainSplitViewController is the window's contentViewController directly, with no SwiftUI host in between. Dragging still works because divider hit-testing is independent of cursor rects.

#1872 fixed a different layer (holding priority and fittingSize so the divider could move at all) and never touched cursors, so it left this in place. The same bug affected four SwiftUI-hosted splits, not just Users and Roles.

Fix

A shared component that every hosted split routes through, rather than a one-off patch:

  • ResizeCursorSplitView: NSSplitView adds a key-window tracking area over a padded divider hit zone and sets the resize cursor in mouseMoved, the same hand-rolled approach SortableHeaderView already uses for column resize. It picks NSCursor.columnResize / rowResize on macOS 15+ and falls back to resizeLeftRight / resizeUpDown on macOS 14.
  • ResizeCursorSplitViewController: NSSplitViewController installs that split view in loadView().
  • CollapsingSplitViewController (Users and Roles list/detail, the privilege editor, and Structure triggers), ServerDashboardSplitView, and QuerySplitView now use it.

Divider hit-testing is a pure SplitDividerCursorGeometry helper so it is unit-tested without a live window. MainSplitViewController (native, already correct) is untouched. A new invariant in CLAUDE.md records why a hosted split needs the explicit cursor.

Testing

  • swiftlint lint --strict: clean on the changed files.
  • Added SplitDividerCursorGeometryTests covering vertical and horizontal dividers, three-pane splits, collapsed panes, and point hit-testing. A live cursor-image assertion is not possible in headless CI, so the pure geometry is the tested boundary.
  • Manual: hover a Users and Roles divider and confirm the resize cursor appears, the divider still drags, and its position still persists.

https://claude.ai/code/session_01A5xT92pokfSFFYVjBgfnJP

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f858f1c96

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +119 to +120
? .columnResize(directions: [.left, .right])
: .rowResize(directions: [.up, .down])

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 Badge Avoid SDK-only cursor APIs in Xcode 15 builds

When building with the documented Xcode 15/macOS 14 SDK, NSCursor.columnResize(directions:) and rowResize(directions:) are not declared, and the #available(macOS 15.0, *) runtime check does not prevent the compiler from resolving those symbols. Since README/CONTRIBUTING still advertise Xcode 15+ support, this makes the app fail to compile for a supported build environment; use the existing resizeLeftRight/resizeUpDown APIs or hide the newer symbols behind an SDK-safe shim.

Useful? React with 👍 / 👎.

@datlechin
datlechin merged commit f1af662 into main Jul 18, 2026
2 of 3 checks passed
@datlechin
datlechin deleted the fix/1905-split-divider-resize-cursor branch July 18, 2026 09:25
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.

missing resize cursor

1 participant