Skip to content

Commit 4ed69ce

Browse files
Control panel: TAB focus follows on-screen cab order
controllableCabs() enumerated world.elevators (insertion order) while the panels render world.sortedElevators (local-first, then by label), so TAB advanced FOCUSED CAB to the next cab in insertion order rather than the one visually below. Walk sortedElevators so focus moves down the list as displayed.
1 parent 07a8862 commit 4ed69ce

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Sources/ElevatorSystem/Views/ControlPanelWindow.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ struct ControlPanelWindow: View {
123123
private func controllableCabs() -> [Elevator] {
124124
// Any cab we can drive -- locally owned, or remote with a live
125125
// link to its owner. The keyboard focus ring walks this set so
126-
// the number / O / C keys can dispatch remote cabs too.
127-
world.elevators.filter { network.canControl($0) }
126+
// the number / O / C keys can dispatch remote cabs too. Use the
127+
// SAME order the panels are rendered in (sortedElevators), so TAB
128+
// advances "FOCUSED CAB" to the cab visually below the current one
129+
// rather than to the next cab in raw insertion order.
130+
world.sortedElevators.filter { network.canControl($0) }
128131
}
129132

130133
private func ensureFocus() {

0 commit comments

Comments
 (0)