NotesFinding

Clicking a pane did nothing, twice

SwiftUI tap gestures do not reach a Metal view that handles its own mouse events. Scripted clicks do not either. Real ones do.

Compare mode got an active pane this week: click a pane, arrow keys move that one. The click handler was the last piece and it refused to work. Twice, for two different reasons.

First reason: the gesture never fires

Each pane is a SwiftUI view wrapping the Metal image view, which handles its own mouse-down for drag-to-pan. We put a SwiftUI tap gesture on the pane. Nothing. A "simultaneous" gesture, meant to run alongside whatever else wants the event. Still nothing.

The Metal view takes the mouse-down and SwiftUI never sees a tap. The fix was to add a click hook on the Metal view itself and route it up through the wrapper, the same way it already reports render failures.

Second reason: the test click never arrives

We drive the app with AppleScript to check things without taking screenshots. Keystrokes work. Menu clicks work. Toolbar buttons clicked by coordinate work. A click by coordinate on the Metal view: nothing. Not even the log line we had put inside the mouse-down handler.

Real clicks do arrive. One from a human hand and the log filled up with mouseDown ... activate: pane 1. The synthesized click gets as far as the window and no further into that view.

What we took from it

When a click handler over a custom NSView is silent, hook the NSView. And when you are checking mouse behaviour on a Metal surface, ask for a real click and read the log. An hour went into proving a working feature was broken.