0 Replies
      Latest reply on Mar 19, 2019 9:55 AM by mleroy
      mleroy Level 1 Level 1 (0 points)

        When a window is presenting a modal sheet, the parent window still responds to `rightMouseDown` events and shows the context menu (if one exists) for the view in the parent window that was clicked. Setting aside the fact that such behavior seems unexpected and at odds with the idea of the sheet being modal to its parent window (all interaction with the parent window should be disabled), this can be problematic for various reasons -- the context menu item's actions may modify application state in such a way that invalidates/interferes with the sheet being presented; the actions may attempt to present a different sheet, dialog, or other UI element that can't be shown due to the current sheet; etc.


        Some apps, for example Numbers, disable most/all of the menu items in the context menus when a sheet is being presented. Is there a built-in way to accomplish this, or a quasi-standard approach? One idea I had was to target the context menu items at First Responder rather than directly at the target object, and rely on automatic menu updating/enabling to disable them when no target for their action can be found (e.g. when a sheet is open) -- but this will break if a context menu has a common action that happens to be implemented somewhere else in the responder chain. I could of course implement menu item validation for every single context menu item and check if a sheet is currently being presented, but that seems like a rather brute force approach. I feel like there's got to be a more elegant solution, but I've been unable to find much discussion on this topic in my searching.


        Thanks in advance!