Conversation
1 task
mikeharv
commented
Jul 24, 2026
| /** | ||
| * Updates the ARIA roles and label for this field. | ||
| */ | ||
| override recomputeAriaContext(): boolean { |
Contributor
Author
There was a problem hiding this comment.
mikeharv
commented
Jul 24, 2026
| * @param e The keydown event. | ||
| * @param rtl Whether the workspace is RTL. | ||
| */ | ||
| private onPixelGridKeyDown(e: KeyboardEvent, rtl: boolean) { |
Contributor
Author
There was a problem hiding this comment.
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.
The basics
The details
Resolves
Fixes #2752
Proposed Changes
Make
@blockly/field-bitmap’s dropdown editor keyboard- and screen-reader-accessible.Editor accessibility (similar implementation to
FieldGridDropdown)grid/row/gridcellstructure with real<button>pixels.aria-haspopup="grid",ariaTypeNamefromARIA_TYPE_FIELD_BITMAP,getAriaValue()summarizing size and filled-pixel count.Pointer painting
setPointerCaptureso drag can continue outside the editor;pointerup/pointerleave/pointercancelend the gesture.clickis suppressed so it does not double-toggle after pointer paint-drag.Messages
BUTTON_LABEL_RANDOMIZE/BUTTON_LABEL_CLEARif present for backwards compatibility.DOM / CSS
.pixelContainer/.pixelRowwith.bitmapPixelGrid/.bitmapPixelRow(CSS grid +display: contentsrows).blocklyFieldon the on-block field group so the cursor matches other fields (default arrow, not grabby hand)..blocklyFieldRectabove the pixel grid so the yellow stroke is visible (SVG strokes are centered; pixels would otherwise cover the inner half).Related Blockly core (separate PR in core)
New/updated Msg strings used by this plugin, including
FIELD_BITMAP_PIXEL_LABEL = '%1, row %2, column %3';(bit value spoken first) andFIELD_BITMAP_ARIA_VALUE = '%1 by %2, %3 pixels on'(dimensions are spoken "by" rather than "x").Block label:

Field label with focus indicator:

Initial cell label with focus indicator:


After pressing the right arrow:
Reason for Changes
The bitmap editor was pointer-only and not exposed as an accessible control. Users who rely on keyboard or assistive tech could not navigate or toggle pixels reliably, and the field did not announce type/value in line with other Blockly fields.
The changes here are kept local to the plugin and no new peer dependencies are established. Before settling on this approach, I entertained the idea of refactoring
@blockly/field-grid-dropdown’sGrid/GridItemso thatFieldBitmapcould use them too. This could have had some long-term maintenance benefits but sharing those components was resulting in a lot of API churn that didn't feel worthwhile (effectively two separate modes). Prior to this, I briefly considered makingFieldBitmapextendFieldGridDropdownbut this wouldn't work as it doesn't really behave like a dropdown (single-choice selection).Test Coverage
Manually tested changes:
DropDownDivephemeral focus.blocklyField).Documentation
.pixelContainer/.pixelRow->.bitmapPixelGrid/.bitmapPixelRow) and<button>pixels for anyone styling the editor.