Repository navigation
fix: fall back to Ruby items before actions in the Material ContextMenu - #78
Merged
AdamMusa merged 1 commit intoNov 2, 2026
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 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.
Bug
A Ruby
context_menu(content, items: [...])never opened on right-click on Android or desktop. QA confirmed this with a probe.ContextMenuControl._getPopupItemsFromButtonpicks the clicked button's own list (primary_items/secondary_items/tertiary_items). When that list is empty, it fell back toactions. Ruby's canonical ContextMenu never sendsactions; that key belongs tocupertino_context_menu. So with the commonitems:form the popup had no entries, and_showMenusent an emptydismissinstead of opening.Fix
The fallback order is now per-trigger list →
items→actions, the same order the iOS renderer uses in #74. This adds one line incontext_menu.dart. A programmaticopen, where no button is pressed, still usesitems.Tests (Material)
New
test/widgets/ruby_material_context_menu_items_test.dart. Each test right-clicks with a real secondary mouse button:items: [Copy, Paste]with default triggers: the popup shows Copy and Paste, and no emptydismissis sent. Choosing "Paste" sendsselectwithb: secondary, id: 11, idx: 1, ic: 2. This failed before the fix: the popup was empty ([]).secondary_itemsstill wins overitems.actionsstays the last fallback.verify_pr.sh(rebased on the current basef137eec):flutter test+752, all passed.flutter analyze lib testfound no issues. Flutter 3.41.2.QA follow-up 1