Repository navigation
Conversation
AdamMusa
pushed a commit
that referenced
this pull request
Nov 3, 2026
Review of #74 found two Material ContextMenu gaps. Both are already closed in the merged code; this pins the one that had no test. - An items-only menu (Ruby's ContextMenu sends `items` and the per-trigger lists, never `actions`): #78 made the Material renderer fall back to `items` before `actions` for every trigger and for a programmatic open, and ruby_material_context_menu_items_test.dart covers the right-click case. - `primary_trigger: "long_press"`: parseContextMenuTrigger goes through the shared parseEnum, which #63 made compare names without case or underscores, so Material accepts Ruby's spelling as iOS does. Nothing tested it on Material. ruby_context_menu_trigger_items_test.dart now long-presses a menu with `primary_trigger` "long_press" and "longPress" on iOS and Android: each shows `primary_items` (not `secondary_items`) and selecting reports b: primary, tr: longPress. With parseEnum as it was before #63 the Android "long_press" case fails (no menu opens). Context menu tests and test/architecture: 317/317. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MqfxcsDiEUZngybe9L72JQ
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #40. This branch is stacked on #40's head (
ffda09c), because it changes the item selection and payload that #40 introduced incupertino_context_menu.dart. The only new commit isa262682.Coordinated with #71 (iOS
ContextMenu.openreplies with an immediateUnsupportedError). This PR touches onlybuild()and the payload helpers. #71 adds the invoke listener at the top of the state class.git merge-treeis clean. I also merged #71 into this branch in a scratch worktree and ran its tests with these:ruby_context_menu_trigger_items_test,ruby_context_menu_events_test(#40) andruby_context_menu_open_test(#71), 12 tests, all passed. Because #71 makesopenfail on iOS, the long press is the only way to reach the menu on iOS. That is why the last-resort rule below exists.Summary
Ruby's
ContextMenudeclaresitems,primary_items,secondary_itemsandtertiary_items, plusprimary_trigger,secondary_triggerandtertiary_trigger. On Material, each mouse button opens its own list using its trigger: by default primary is disabled and secondary and tertiary aredown. A button with an empty list falls back toitems, thenactions.The iOS renderer read only
actions/items. The per-button lists were ignored, and a menu configured only with them rendered an error box on iOS.Decision: what the iOS long press means
iOS has a single context-menu gesture, the long press (
CupertinoContextMenu, the counterpart of UIKit'sUIContextMenuInteraction). It stands in for the pointer button a desktop user would use for the same menu:primary_triggerislong_press, because the author bound this exact gesture;secondary_triggerisdisabled;The menu then shows that button's list, else
items, elseactions, exactly Material's fallback. As a last resort, if those are all empty but another per-button list has items (for example onlytertiary_items, a middle click with no touch equivalent), the long press shows it. iOS has no other way to open the menu, so the menu stays reachable instead of becoming an error box. The error remains only when every list is empty.tertiary_itemsis therefore used on iOS only through this last resort. Aprimary_trigger: "down"(tap-to-open) has no native equivalent, so a primary list bound to a tap is reachable by long press only through the last resort.Payload
selectanddismisskeep #40's Material keys.bis now the button the long press stood for, andtris that button's configured trigger, spelled as Material reports it (down,longPress,disabled). Previously these were hard-coded toprimaryandlongPress. With default triggers, an iOS long press now reports the sameb: "secondary", tr: "down"as a right-click on Material.gandlstaynull.Tests
New
test/widgets/ruby_context_menu_trigger_items_test.dart(6 tests):itemsonly: the long press showsitems.selectsends{b: secondary, tr: down, id: 11, idx: 1, ic: 2}.secondary_items.primary_trigger: "long_press": showsprimary_items, withb: primary, tr: longPress.secondary_trigger: "disabled": falls back toitems.tertiary_items: no error box, the long press shows it,b: tertiary.secondary_items, then "Rename", gives the same{b, tr, id, idx, ic}as the iOS long press, then "Rename".Five of the six failed before this change. The disabled-secondary case already showed
items, so it is kept as a guard. #40's tests still pass.verify_pr.sh(branch head, which includes #40):flutter test+704, all passed (695 baseline + 3 from #40 + 6 new).flutter analyze lib testfound no issues. Flutter 3.41.2. Merges cleanly with the current basefced255.Wave-3 item 2