NSHostingView stops receiving mouse events when layered above another NSHostingView (macOS Tahoe 26.2)

I’m running into a problem with SwiftUI/AppKit event handling on macOS Tahoe 26.2.

I have a layered view setup:

  • Bottom: AppKit NSView (NSViewRepresentable)

  • Middle: SwiftUI view in an NSHostingView with drag/tap gestures

  • Top: Another SwiftUI view in an NSHostingView

On macOS 26.2, the middle NSHostingView no longer receives mouse or drag events when the top NSHostingView is present. Events pass through to the AppKit view below. Removing the top layer immediately restores interaction. Everything works correctly on macOS Sequoia.

I’ve posted a full reproducible example and detailed explanation on Stack Overflow, including a single-file demo:

Stack Overflow post: https://stackoverflow.com/q/79862332

I also found a related older discussion here, but couldn’t get the suggested workaround to apply: https://developer.apple.com/forums/thread/759081

Any guidance would be appreciated.

Thanks!

Removing the top layer immediately restores interaction. Everything works correctly on macOS Sequoia.

This could be a regression. Please file a Feedback report and share the Feedback ID number here.

On macOS 26.2, the middle NSHostingView no longer receives mouse or drag events when the top NSHostingView is present. Events pass through to the AppKit view below.

Have you tried overing hitTest on the Top Layer to pass events through If the hit test returns it's self rather than a subview?

Thanks for your reply. The feedback ID is FB21579636

Yes, I've tried overriding hitTest and in fact noticed that the mouse events simply pass through some swiftUI controls like swiftUI buttons. Using AppKit controls instead fixes the issue, but is not convenient.

@AIdyn_ I can confirm that it is the expected behavior.

The correct solution here is to override hitTest and route events as desired. For example, disable user interaction in top NSHostingView by returning nil from its hitTest to always pass clicks through to the middle one.

Thanks, but if you look at the demo code in my post: https://stackoverflow.com/questions/79862332/nshostingview-with-swiftui-gestures-not-receiving-mouse-events-behind-another-ns,

I tried logging the hit tests for both the top and middle NSHostingViews. The logs confirm that clicks are reaching both views, but the middle layer’s button with the DragGesture still doesn’t respond.

Do you know how your solution could be used here?

NSHostingView stops receiving mouse events when layered above another NSHostingView (macOS Tahoe 26.2)
 
 
Q