Skip to content

Reposition and clip context bar - #724

Merged
lawsie merged 2 commits into
flipcomputing:mainfrom
lawsie:context-bar-bugfix
Jul 28, 2026
Merged

Reposition and clip context bar#724
lawsie merged 2 commits into
flipcomputing:mainfrom
lawsie:context-bar-bugfix

Conversation

@lawsie

@lawsie lawsie commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

When the canvas resizes, move the block context bar with the block, don't just leave it stranded.
If the context bar overlaps the toolbox (or anything to the left of it) clip it on the left edge.

AI usage

Claude Sonnet 5 used throughout. Plan implemented by me (which was a lot simpler than Claude's plan)

Summary by CodeRabbit

  • Bug Fixes
    • Improved floating toolbar positioning when the canvas is resized.
    • Prevented the toolbar from overlapping the toolbox or flyout area.
    • Kept keyboard shortcut badges aligned when the toolbar is repositioned or clipped.

@coderabbitai

coderabbitai Bot commented Jul 28, 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: 42 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 Plus

Run ID: 2e9dc218-418c-43b7-bba8-231606e73812

📥 Commits

Reviewing files that changed from the base of the PR and between e953abf and 956a50e.

📒 Files selected for processing (2)
  • main/view.js
  • ui/contextmenu.js
📝 Walkthrough

Walkthrough

The floating block toolbar now repositions on canvas resize, calculates the toolbox boundary, clips itself when overlapping the toolbox, and refreshes keyboard shortcut badges after repositioning.

Changes

Floating toolbar positioning

Layer / File(s) Summary
Resize handling and toolbox boundary
ui/contextmenu.js
The toolbar repositions after canvas resize events, calculates the rightmost toolbox or flyout boundary, and resets prior clipping.
Overlap clipping and badge refresh
ui/contextmenu.js
positionBlockToolbar() clips horizontal overlap with the toolbox and refreshes keyboard-mode shortcut badges.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • flipcomputing/flock#716: Both changes modify floating block toolbar positioning and visibility behavior in ui/contextmenu.js.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: the context bar is repositioned and clipped.
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: 2

🤖 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 `@ui/contextmenu.js`:
- Around line 931-938: The toolbox overlap handling currently clips only
blockToolbar while renderBadges positions badgeOverlay from unclipped button
rectangles. Update renderBadges and its keyboard-mode call site to receive and
apply the computed toolboxRight visible boundary, filtering or clipping badges
so those belonging to hidden button areas do not render over the toolbox;
preserve normal badge placement when no overlap exists.
- Around line 856-859: Defer the positionBlockToolbar() call in the
flock:canvas-resize listener until after main/view.js completes its scheduled
Blockly.svgResize(workspace) layout update. Use a post-layout dispatch or
coalesced callback ordered after that resize callback; do not rely on a single
requestAnimationFrame from this listener, since it would execute too early.
🪄 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 Plus

Run ID: 0ec229c2-f990-4d95-812f-f4f1871bd1bb

📥 Commits

Reviewing files that changed from the base of the PR and between 6507c87 and e953abf.

📒 Files selected for processing (1)
  • ui/contextmenu.js

Comment thread ui/contextmenu.js Outdated
Comment thread ui/contextmenu.js
@lawsie
lawsie merged commit f519ae1 into flipcomputing:main Jul 28, 2026
3 checks passed
@lawsie
lawsie deleted the context-bar-bugfix branch July 28, 2026 09:04
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