Small click areas in SwiftUI .contextMenu with List on a Mac
I am having a problem with SwiftUI on the Mac when sometimes context menus stop appearing when I Control-click (Right-click) space on the left side of the List
item. I am talking about small leading padding which is highlighted with a primary colour when an item is selected. It should be always possible Control-click to reveal the context menu when clicking surrounding area but sometimes it stops working until I reinstall my app or some time passes, which tells me it could be a bug in SwiftUI. I use Label
for my list items which have icons and text. I have tried multiple approaches and couldn’t find how to solve it yet.
Related links
- contextMenu(menuItems:)
- contextMenu(forSelectionType:menu:primaryAction:)
- ContextMenu of List stops working when applying custom DisclosureGroupStyle in macOS
- Context Menus for Tables
- How to control the tappable area of a view using contentShape()
- Set a Preview Shape for Views Presenting Context Menus
Sonoma, Xcode 15.1.