Fix menu focus scope#528
Conversation
|
Warning Review limit reached
More reviews will be available in 20 minutes and 47 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
lambda-editor | 7a7b9d9 | Commit Preview URL Branch Preview URL |
Jun 05 2026, 03:54 PM |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bd8f1568a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub fn Model::focus_cmd_within(self : Model, root_id~ : String) -> @rabbita.Cmd { | ||
| self.focus_item_cmd(id => focus_element_by_id_within(root_id, id)) | ||
| } |
There was a problem hiding this comment.
Expose scoped focus through context menus
When this menu behavior is used through lib/context-menu inside an open shadow root, callers still cannot use the scoped lookup added here: lib/context-menu/src/context_menu/types.mbt keeps the embedded @menu.Model private (lines 62-64) and its public Model::focus_cmd still delegates to document-global self.menu.focus_cmd() (lines 201-202). That leaves context-menu consumers stuck on document.getElementById even though they hit the same duplicate-id/shadow-root scenario, so please add a matching scoped focus API on the wrapper or otherwise route it through this method.
Useful? React with 👍 / 👎.
Benchmark Comparison ReportComparing PR branch against Main Module BenchmarksBase branch: PR branch: event-graph-walker BenchmarksBase branch: PR branch: Benchmarks run with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ade7c72d0a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| model. If the context menu is rendered under a scoped container or open shadow | ||
| root, use `Model::focus_cmd_within(root_id=...)` instead so item focus is looked | ||
| up through the same scoped menu strategy as `lib/menu`. |
There was a problem hiding this comment.
Avoid advertising shadow-root context menus prematurely
For context menus rendered inside an open shadow root, swapping item focus to focus_cmd_within is not enough: the same README flow still calls position_cmd() and subscriptions(), but those helpers resolve the panel with document.getElementById(self.id) in lib/context-menu/src/context_menu/positioning.mbt and lib/context-menu/src/context_menu/subscriptions.mbt, which cannot see shadow-root contents. In that scenario the panel will not be measured/repositioned after open, and pointer/key dismissal checks can treat interactions inside the menu as outside; please either add scoped variants for those panel lookups or narrow this guidance to plain lib/menu item focus only.
Useful? React with 👍 / 👎.
Summary
Model::focus_cmd_within(root_id~)for scoped/headless menu item focus.Model::focus_cmd()behavior unchanged for Ideal and other light-DOM consumers.Closes #511.
Reuse check
@cmd.custom_cmd(..., kind=@cmd.after_render)for after-patch focus effects.focused_item_id()helper.lib/tabsandlib/context-menu, but left them unchanged because Make headless Menu focus strategy scope-aware #511 is scoped tolib/menuitem focus.lib/dom-boundary: it is document-global and JS-only, whilelib/menumust keep itsjs+nativepackage contract.Validation
NEW_MOON_MOD=0 moon check --deny-warnNEW_MOON_MOD=0 moon testNEW_MOON_MOD=0 moon build --target js --releaseNEW_MOON_MOD=0 moon test --target js lib/menu/src/menucd examples/ideal/web && CANOPY_SKIP_RELAY_SERVER=1 VITE_CANOPY_SKIP_SYNC=1 npx playwright test e2e/structural-editing.spec.ts --reporter=linegit diff --check