From 8e69052cd04236c0f9bd31fc3ebdce4516f783aa Mon Sep 17 00:00:00 2001 From: Mike Harvey <43474485+mikeharv@users.noreply.github.com> Date: Fri, 17 Jul 2026 12:45:25 -0400 Subject: [PATCH 1/2] feat: add setAriaTypeName method for Fields --- packages/blockly/core/field.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/blockly/core/field.ts b/packages/blockly/core/field.ts index 9b967baa135..b254e6704a6 100644 --- a/packages/blockly/core/field.ts +++ b/packages/blockly/core/field.ts @@ -318,6 +318,18 @@ export abstract class Field return this.ariaTypeName || null; } + /** + * Sets the ARIA-friendly label representation of this field's type. + * + * Implementations are responsible for, and encouraged to, set a localized + * version of the ARIA representation of the field's type. + * + * @param ariaTypeName An ARIA representation of the field's type. + */ + setAriaTypeName(ariaTypeName: string) { + this.ariaTypeName = ariaTypeName; + } + /** * Gets an ARIA-friendly label representation of this field's value. * From dac761d465d2269b0b7070d3d33b96e043c84c11 Mon Sep 17 00:00:00 2001 From: Mike Harvey <43474485+mikeharv@users.noreply.github.com> Date: Fri, 17 Jul 2026 14:01:22 -0400 Subject: [PATCH 2/2] chore: add test --- packages/blockly/tests/mocha/field_test.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/blockly/tests/mocha/field_test.js b/packages/blockly/tests/mocha/field_test.js index 373f44133ea..e01369a2462 100644 --- a/packages/blockly/tests/mocha/field_test.js +++ b/packages/blockly/tests/mocha/field_test.js @@ -896,6 +896,13 @@ suite('Abstract Fields', function () { assert.equal(field.computeAriaLabel(true), 'text: hello'); }); + test('Custom type and value when ariaTypeName is set', function () { + const field = new TestField(); + field.setAriaTypeName('speed'); + field.setValue('fast'); + assert.equal(field.computeAriaLabel(), 'speed: fast'); + }); + test('Type and placeholder when value is null', function () { const field = new TestField(null, {ariaTypeName: 'text'}); assert.equal(