combine: add Menu action variant to buttons - #64
Conversation
A buttons action can now be a press-to-open native dropdown menu (menu_trigger + dropdown_menu child) alongside plain press buttons. The trigger rides in a sizing cell so the glass capsule chrome and hit area match the sibling press capsules; a 'capsule' style class tells the Apple backend to stretch the Menu label's frame and contentShape across the cell.
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
iOS simulator verification — Verified on iPhone 17 sim (iOS 27.0) in the LUIComponents gallery "Glass Buttons" section, driving real taps on the Simulator window with
Full annotated recording: |
The menu trigger's sizing cell is a box, which is not a legal toolbar child — wrapping it in a button_group keeps lone menu capsules mountable inside toolbars like the press capsules.
|
Icon-size fix (83bcb3a) verified on iOS sim ✅
|
Summary
Lui_element_combine.buttonsactions are now polymorphic:Press(existing behavior) orMenu(press-to-open native dropdown). This is a breaking change to the youngactionrecord — callers wrap their record inPress(gallery and tests updated here; the journalV.buttonswrapper gets a matching wrap in its own PR).A
Menuaction mounts amenu_trigger+dropdown_menuinside a sizing cell (box ~height:44, icon-only →~width:44) rather than in a barebutton_groupslot.MenuTriggercarries no surface properties in the wire protocol, so the capsule chrome (glass background, 999 corner radius) lives on the wrapping cell — no wire whitelist or schema changes needed;style-classwas already supported onMenuTrigger.Hit area: the trigger gets
style_class:"capsule", whichLUIMenuTriggerViewuses to stretch its label to the full cell frame with.contentShape(Rectangle())(same pattern as the PR #56 toolbar hit fix): icon-only cells greedy-fill the pinned 44×44 frame; text cells greedy-fill height and take 12pt horizontal padding inside the hit region.buttonssemantics unchanged:[]→invalid_arg; a single action (press or menu) gets its own glass capsule; multiple share abutton_groupcapsule.Gallery ("Glass Buttons" section) demos a standalone icon-only menu action and a fused press+menu capsule.
Caveat
Inside a hoisted toolbar
capsulesegment (ControlGroup), aMenuaction renders a nativeMenu— it stays tappable but does not get the fused ControlGroup styling thatButtonmembers get. Acceptable for now sincebuttonsisn't used there yet.Verification
dune build+dune runtest: 29 tests pass, incl. newmenu actiontest (single capsule → MenuTrigger → DropdownMenu → MenuItem; menu-item press dispatches its handler; group has Button + Box cells).swift build --package-path platform/apple: clean.Link to Devin session: https://app.devin.ai/sessions/3bce435625ba4bc086c09520e0920db5
Open in Devin Desktop: https://app.devin.ai/desktop/session/3bce435625ba4bc086c09520e0920db5?variant=devin
Requested by: @RCmerci