Skip to content

Conversation

@BenHenning
Copy link
Collaborator

@BenHenning BenHenning commented Nov 14, 2025

The basics

The details

Resolves

Fixes #9450

Proposed Changes

Reason for Changes

Test Coverage

Documentation

Additional Information

This also fills in more field labels (particularly for options) and adds
example 'where am I?' shortcuts for team testing.
@github-actions github-actions bot added the PR: feature Adds a feature label Nov 14, 2025
@BenHenning
Copy link
Collaborator Author

This needs a bunch of explanation and work yet. It largely adds good naming for fields and drop-downs for all but the dynamic cases (since those are trickier and may need some additional work to make it possible).

It also splits field labels into type and values and largely keeps the type out of the block readout unless using new shortcuts.

Two new shortcuts:

  • ctrl/command + shift + I: prints out a verbose readout of the current block
  • ctrl/command + shift + P: prints out a verbose readout of the current block's parent

These are meant to provide initial possibilities as part of addressing RaspberryPiFoundation/blockly-keyboard-experimentation#764.

@BenHenning
Copy link
Collaborator Author

From feedback: ensure fields always read out their type + value (verbose) when focused.

core/field.ts Outdated
*
* @returns An ARIA representation of the field's value.
*/
abstract getAriaValue(): string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could this not be abstract and have a default implementation that returned an empty string (or null)? I found myself going through and returning empty strings for quite a few custom fields in order to get up and running with this change, and having a default implementation would reduce the overhead.

Copy link
Collaborator Author

@BenHenning BenHenning Nov 20, 2025

Choose a reason for hiding this comment

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

I was on the fence of going with a default implementation but this gives strong incentive to. Within core Blockly we more or less need to explicitly decide what to provide here in all cases so I didn't have enough context to decide on a default value.

Could you maybe provide some context on why so many of your custom fields have an empty string? I'd expect that to be atypical in general since I expect that basically all fields have a non-default value (except maybe text input when nothing has yet been inputted).

BenHenning added a commit that referenced this pull request Dec 3, 2025
## The basics

- [x] I [validated my changes](https://developers.google.com/blockly/guides/contribute/core#making_and_verifying_a_change)

## The details
### Resolves

Fixes part of RaspberryPiFoundation/blockly-keyboard-experimentation#764
Fixes part of #9450 (infrastructure needs)

### Proposed Changes

Introduces support for two new "where am I?" shortcuts for helping to provide location context for users:
- `I`: re-reads the current selected block with full verbosity (i.e. also includes the block's field types with their values in the readout).
- `shift+I`: reads the current selected block's parent with full verbosity.

Note that this includes some functional changes to `Field` to allow for more powerful customization of a field's ARIA representation (by splitting up value and type), though a field's value defaults potentially to null which will be ignored in the final ARIA computed label. This seems necessary per the discussion here: https://github.com/RaspberryPiFoundation/blockly/pull/9470/files#r2541508565 but more consideration may be needed here as part of #9307.

Some limitations in the new shortcuts:
- They will not read out anything if a block is not selected (e.g. for fields and icons).
- They read out input blocks when the input block is selected.
- They cannot read out anything while in move mode (due to the behavior here in the plugin which automatically cancels moves if an unknown shortcut is pressed: https://github.com/RaspberryPiFoundation/blockly-keyboard-experimentation/blob/a36f3662b05c2ddcd18bde8745777fff8dc3df31/src/actions/mover.ts#L166-L191).
- The readout is limited by the problems of dynamic ARIA announcements (per #9460).

### Reason for Changes

RaspberryPiFoundation/blockly-keyboard-experimentation#764 provides context on the specific needs addressed here.

### Test Coverage

Self tested. No new automated tests needed for experimental work.

### Documentation

No new documentation needed for experimental work.

### Additional Information

This was spun out of #9470 with the intent of getting shortcuts initially working checked in even if the entirety of the experience is incomplete.
@BenHenning BenHenning linked an issue Dec 3, 2025 that may be closed by this pull request
1 task
@github-actions github-actions bot added PR: feature Adds a feature and removed PR: feature Adds a feature labels Dec 3, 2025
@BenHenning BenHenning changed the title feat: field and block label improvements (experimental) feat: field label improvements (experimental) Dec 3, 2025
@github-actions github-actions bot added PR: feature Adds a feature and removed PR: feature Adds a feature labels Dec 3, 2025
@BenHenning
Copy link
Collaborator Author

The shortcut bits have been moved out of this branch and into #9481 (which is now merged into the experimental branch). Bringing this up-to-date to focus on specifically the label improvements.

@BenHenning
Copy link
Collaborator Author

BenHenning commented Dec 3, 2025

Hmm I inadvertently undid my changes. :)

Edit: They should now be back. I still need to go through and double check that all fields have been accounted for, and add support for blocks defined through functions rather than JSON.

This reverts commit 6a7e5e0.

Conflicts:
	blocks/math.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: feature Adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

All fields should have ARIA label overrides

2 participants