Skip to content

Close add menu when Ctrl + G pressed#694

Merged
lawsie merged 2 commits into
flipcomputing:mainfrom
lawsie:bugfix-close-addmenu
Jul 7, 2026
Merged

Close add menu when Ctrl + G pressed#694
lawsie merged 2 commits into
flipcomputing:mainfrom
lawsie:bugfix-close-addmenu

Conversation

@lawsie

@lawsie lawsie commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes the add shape menu when Ctrl + G pressed so that you can see the gizmos you are selecting

Old behaviour:
image

AI usage

Claude Sonnet 4.6 wrote all of the code. Not a difficult fix.

Summary by CodeRabbit

  • Bug Fixes
    • Opening the gizmo overlay now automatically closes other open menus, preventing overlapping panels.
    • The shapes dropdown is now hidden and cleaned up when the overlay opens, reducing UI clutter and avoiding interrupted placement mode.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@lawsie, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 20bb8f21-292a-4b45-b1a1-6cbde36fb8eb

📥 Commits

Reviewing files that changed from the base of the PR and between ac227aa and e850c70.

📒 Files selected for processing (1)
  • accessibility/keyboardui.js
📝 Walkthrough

Walkthrough

GizmoMenuManager gains a _closeHooks array and a registerCloseHook(fn) method; toggle(show) now invokes all registered hooks when opening the gizmo overlay. ui/addmenu.js registers a hook to hide the shapes dropdown, clear keyboard navigation state, and cancel placement mode on overlay open.

Changes

Gizmo Overlay Close Hooks

Layer / File(s) Summary
Close hook registry and invocation
accessibility/keyboardui.js
Adds internal _closeHooks array and registerCloseHook(fn) method; toggle(show) runs all registered hooks before opening the gizmo overlay.
Shapes dropdown close hook wiring
ui/addmenu.js
Registers a close hook that hides the shapes dropdown, removes keyboard navigation state, and cancels placement when the gizmo overlay opens.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GizmoMenuManager
    participant AddMenu

    User->>GizmoMenuManager: Ctrl+G (toggle overlay open)
    GizmoMenuManager->>GizmoMenuManager: _closeHooks.forEach(fn)
    GizmoMenuManager->>AddMenu: invoke registered close hook
    AddMenu->>AddMenu: hide shapes-dropdown
    AddMenu->>AddMenu: remove keyboard navigation state
    AddMenu->>AddMenu: cancelPlacement()
    GizmoMenuManager->>GizmoMenuManager: continue opening overlay
Loading

Possibly related PRs

  • flipcomputing/flock#591: Introduces the GizmoMenuManager overlay toggle/open flow that this PR extends with close hooks.
  • flipcomputing/flock#608: Also modifies GizmoMenuManager open/close behavior, including closing other UI elements.
  • flipcomputing/flock#615: Also updates GizmoMenuManager toggle behavior for the gizmo overlay open/close flow.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main behavior change: the add menu closes when Ctrl+G opens the gizmo overlay.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@accessibility/keyboardui.js`:
- Around line 247-254: The close-hook execution in toggle(show) can abort the
overlay-open flow if any registered hook throws, so isolate failures in
KeyboardUI.toggle and keep the rest of the open sequence running. Update the
_closeHooks.forEach invocation to catch errors per hook (and optionally log
them) so one bad hook does not prevent renderBadges, watcher setup, or focus
management from completing; use the registerCloseHook and toggle methods to
locate the fix.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f0120850-626b-4083-9d93-f463894d54fd

📥 Commits

Reviewing files that changed from the base of the PR and between 47604f8 and ac227aa.

📒 Files selected for processing (2)
  • accessibility/keyboardui.js
  • ui/addmenu.js

Comment thread accessibility/keyboardui.js Outdated
@lawsie lawsie merged commit b424f15 into flipcomputing:main Jul 7, 2026
3 checks passed
@lawsie lawsie deleted the bugfix-close-addmenu branch July 7, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant