fix: Correct ARIA label is for invalid values. (#9469)

## The basics

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

## The details
### Resolves

Fixes #9466

### Proposed Changes

Ensures `FieldInput`'s ARIA labels are recomputed when an invalid value is attempted to be set.

### Reason for Changes

Previously the `FieldInput` would continuously update its ARIA label as the value changed, including for invalid values. If the editor was cancelled this would correctly revert but if an invalid value was attempted to be saved then it would cancel the update but not correct the ARIA label.

### Test Coverage

No new tests are needed for this experimental change. This has been manually verified locally using `FieldNumber` in Core's advanced playground.

### Documentation

No documentation changes are needed for this experimental change.

### Additional Information

None.
This commit is contained in:
Ben Henning
2025-11-19 14:31:04 -08:00
committed by GitHub
parent 6073b00c19
commit 141e28d1de

View File

@@ -227,6 +227,7 @@ export abstract class FieldInput<T extends InputTypes> extends Field<
const oldValue = this.value_;
// Revert value when the text becomes invalid.
this.value_ = this.valueWhenEditorWasOpened_;
this.recomputeAriaLabel();
if (
this.sourceBlock_ &&
eventUtils.isEnabled() &&