reports icon indicating copy to clipboard operation
reports copied to clipboard

FB20753336: Menu inside ToolbarItemGroup crashes when containing a titled `.palette` style ControlGroup with text-only Button

Open samhenrigold opened this issue 2 weeks ago • 0 comments

Submission Date

2025-10-20

Status

Open

Area

SwiftUI

Operating System Version

macOS 26.0.1 (23A262)

Type

Incorrect/Unexpected Behavior

Description

On macOS in a native SwiftUI app, tapping a Menu placed inside a ToolbarItemGroup can crash the app if the menu contains a ControlGroup styled as .palette AND that control group has a title AND its buttons are text-only (no icon). The same code works fine on iOS. When it doesn't crash, macOS still fails to render the text label for the button; only a hover checkmark appears in the empty space.

Expected Results:

  • The menu opens reliably.
  • The .palette control group appears with its title.
  • The text label (“100%” / “Zoom In”, etc.) is visible if .labelStyle(.titleOnly) is used.

Actual Results: Either an (intermittent) crash: Clicking the menu button causes a crash within AppKit layout while the contextual menu is being constructed/tracked. If it doesn’t crash:

  • The menu renders an empty slot for the text-only button (label not shown).
  • Hovering reveals only a checkmark image (it will always be a checkmark image, no matter what)
  • Even when a button is declared with systemImage and .labelStyle(.titleOnly), the label remains invisible and only the hover checkmark appears.

Stack Trace (top frames):

#0  0x0000000197cd4a00 in ___lldb_unnamed_symbol183121 ()
#1  0x0000000197cd4a24 in ___lldb_unnamed_symbol183122 ()
#2  0x0000000197e3f500 in ___lldb_unnamed_symbol188412 ()
#3  0x0000000197ee8604 in ___lldb_unnamed_symbol191329 ()
#4  0x0000000197d9e9f8 in ___lldb_unnamed_symbol186310 ()
...
#54 0x000000019854b22c in -[NSCocoaMenuImpl popUpMenu:...]
#56 0x000000019842b464 in -[NSPopUpButtonCell trackMouse:...]
#63 0x00000001980106ec in -[NSApplication _handleEvent:]

The first unnamed symbol disassembles into AppKit code that references NSInlineMenuItemView and geometry calculations (CGRect midpoints/heights) during menu layout:

... OBJC_METACLASS_$_NSInlineMenuItemView ...
swift_unknownObjectWeakLoadStrong
CGRectGetHeight / CGRectGetMidX / CGRectGetMidY
...
0x197cd49f8 <+860>: brk #0x1
0x197cd49fc <+864>: brk #0x1
0x197cd4a00 <+868>: brk #0x1

Nudge.zip

Keywords

No response

Prerequisites

  • [x] The title follows the format FB<number>: <title>
  • [x] I will keep this issue updated with Apple's responses

samhenrigold avatar Dec 16 '25 14:12 samhenrigold