Skip to content

Add Enable/Disable button to context bar - #739

Merged
lawsie merged 4 commits into
flipcomputing:mainfrom
lawsie:enable-button-context-bar
Aug 6, 2026
Merged

Add Enable/Disable button to context bar#739
lawsie merged 4 commits into
flipcomputing:mainfrom
lawsie:enable-button-context-bar

Conversation

@lawsie

@lawsie lawsie commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Added an enable/disable button to the block context bar with the keyboard shortcut L. The icon shows the current state, clicking/pressing L toggles the state.

image

AI usage

Claude Sonnet 5 used throughout. Decisions made by me.

Summary by CodeRabbit

  • New Features
    • Added an L keyboard shortcut to enable or disable the selected block.
    • Added a toolbar button for toggling a block’s enabled state, with visual status indicators.
    • The control is unavailable for locked or unsupported blocks.
    • Added localized shortcut labels across supported languages.

@coderabbitai

coderabbitai Bot commented Aug 6, 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: 43 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: 1fe0d337-b4dd-42ff-be0a-294516300d2c

📥 Commits

Reviewing files that changed from the base of the PR and between 314154c and 6cbcafb.

📒 Files selected for processing (1)
  • main/blocklyinit.js
📝 Walkthrough

Walkthrough

The editor adds an L shortcut and toolbar button to toggle a block’s MANUALLY_DISABLED state. The control supports localized labels, updates its icon and label, and excludes locked blocks.

Changes

Block enable/disable controls

Layer / File(s) Summary
Shortcut metadata and translations
accessibility/keyboardui.js, locale/{de,en,es,fr,it,pl,pt,sv}.js
Adds the L shortcut entry and localized labels for enabling or disabling blocks.
Keyboard toggle handling
main/blocklyinit.js
Resolves an eligible focused block or field target, toggles MANUALLY_DISABLED, and groups the change as toolbar_disable.
Toolbar control and state synchronization
ui/contextmenu.js
Adds the toolbar button, icons, shortcut badge, locked-block visibility rule, and disabled-state refresh behavior.

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

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant keyboardui.js
  participant blocklyinit.js
  participant BlocklyBlock
  participant BlocklyEvents
  User->>keyboardui.js: Press L
  keyboardui.js->>blocklyinit.js: Invoke enable/disable shortcut
  blocklyinit.js->>BlocklyBlock: Resolve target and toggle MANUALLY_DISABLED
  blocklyinit.js->>BlocklyEvents: Group state change as toolbar_disable
Loading

Possibly related PRs

Suggested reviewers: tracygardner, claude

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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 clearly and concisely describes the primary change: adding an enable/disable button to the block context bar.
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 `@main/blocklyinit.js`:
- Around line 1614-1620: In the shortcut callback around enableTargetBlock, use
the second event argument and call its optional preventDefault method before
toggling the block’s disabled state. Preserve the existing editability check and
toggle behavior, while preventing the key from being inserted into a focused
field.

In `@ui/contextmenu.js`:
- Around line 1307-1317: Update the enableBtn activation handler to respond to
native button click events so focused keyboard activation via Enter or Space
performs the same toggle. Preserve the existing pointer behavior without
triggering the action twice, and keep the current block state update and
rendering logic unchanged.
🪄 Autofix

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: 2f375b5b-5da1-4ab5-bed7-cba6e842bcbf

📥 Commits

Reviewing files that changed from the base of the PR and between e22ac04 and 314154c.

📒 Files selected for processing (11)
  • accessibility/keyboardui.js
  • locale/de.js
  • locale/en.js
  • locale/es.js
  • locale/fr.js
  • locale/it.js
  • locale/pl.js
  • locale/pt.js
  • locale/sv.js
  • main/blocklyinit.js
  • ui/contextmenu.js

Comment thread main/blocklyinit.js Outdated
Comment thread ui/contextmenu.js
@lawsie
lawsie merged commit 14bb6a0 into flipcomputing:main Aug 6, 2026
3 checks passed
@lawsie
lawsie deleted the enable-button-context-bar branch August 6, 2026 11:02
@coderabbitai coderabbitai Bot mentioned this pull request Aug 11, 2026
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