Repository navigation
fix(lists): give clicked lists keyboard focus and make Return and Delete work in AppKit lists - #4175
Merged
Merged
Conversation
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
ListorTablerow selects it, but the backingNSTableViewnever becomes first responder (FB25239926, Apple forum thread 845762).onDeleteCommand,onCopyCommand,onKeyPressand ReturnprimaryActionnever fire after a click.Appwindow fails the same way, so the AppKit lifecycle is not the cause.TableClickFocusfixes all 36 SwiftUI list and table sites in one place, with no call site edited.KeyRepeatFilter, on macOS 27 only.NSTableView.mouseDown.NSTableView.keyDownnever interprets those keys, so theirinsertNewline(_:)anddeleteBackward(_:)handlers never ran.NSTableView.interpretCommandKey(_:), used bySidebarOutlineViewandWorkspaceRailTableView, sends unmodified Return, Enter, Delete and Forward Delete throughinterpretKeyEvents.Listinside a groupedFormnever scrolls, so rows past the height cap could not be reached. The host list, attached databases and SQLite extensions lists now grow to fit every row, and the Form scrolls.FavoritesOutlineView,SidebarRootShape,FavoritesTabViewandAppearanceSettingsView, and the example in.claude/rules/ui-lifecycle.md. They blamed the bareNSHostingControllerfor this bug.Test plan
TableClickFocusTests(10 cases): an unselected row is claimed after mouse-up and a selected row at mouse-down. A focus the click itself moves elsewhere stays there, and one it leaves vacant goes to the table. A Control-click, a text field in a row, an AppKit table, an app table whose cell takes the hit, and a table that refuses focus are left alone. A real SwiftUIListrow is claimed; that case is gated on a host probe, since SwiftUI's view tree is private.TableCommandKeyTests(6 cases): Return, Enter, Delete and Forward Delete reach their commands. Shift-modified keys and Down are left to the table. A Return nobody answers travels up, and Return on the connections strip reaches its controller.ListClickFocusUITests: click a connection form section, check that the list holds the keyboard, then press Up and check that the selection moves. The CI runner is on macOS 26, where the bug does not exist, so there this only pins the flow.WelcomeConnectionListUITests.testReturnOnASelectedConnectionOpensIt: fails on main (Return did nothing) and passes here.