Skip to content

Commit 1a5e7e5

Browse files
authored
fix: use placeholder for empty inputs in block labels (#9987)
* fix: use placeholder for empty inputs in block labels * chore: linting
1 parent 99c7979 commit 1a5e7e5

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

packages/blockly/core/block_aria_composer.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,13 @@ export function computeFieldRowLabel(
172172
return computeFieldRowLabel(inputs[index - 1], lookback, verbosity);
173173
}
174174
}
175+
if (
176+
input.type === inputTypes.VALUE &&
177+
input.connection?.targetConnection === null &&
178+
verbosity >= Verbosity.STANDARD
179+
) {
180+
fieldRowLabel.push(Msg['INPUT_LABEL_EMPTY']);
181+
}
175182
return fieldRowLabel.filter((label) => !!label);
176183
}
177184

packages/blockly/tests/mocha/shortcut_items_test.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,9 @@ suite('Keyboard Shortcut Items', function () {
843843
block.initSvg();
844844
block.render();
845845
Blockly.getFocusManager().focusNode(block);
846-
this.assertAnnouncement('Begin stack, if, do, First category, has input');
846+
this.assertAnnouncement(
847+
'Begin stack, if, Empty, do, First category, has input',
848+
);
847849
});
848850

849851
test('Icon', function () {
@@ -853,7 +855,9 @@ suite('Keyboard Shortcut Items', function () {
853855
Blockly.getFocusManager().focusNode(
854856
block.getIcon(Blockly.icons.IconType.MUTATOR),
855857
);
856-
this.assertAnnouncement('Begin stack, if, do, First category, has input');
858+
this.assertAnnouncement(
859+
'Begin stack, if, Empty, do, First category, has input',
860+
);
857861
});
858862

859863
test('Field', function () {
@@ -869,7 +873,9 @@ suite('Keyboard Shortcut Items', function () {
869873
block.initSvg();
870874
block.render();
871875
Blockly.getFocusManager().focusNode(block.getInput('DO0').connection);
872-
this.assertAnnouncement('Begin stack, if, do, First category, has input');
876+
this.assertAnnouncement(
877+
'Begin stack, if, Empty, do, First category, has input',
878+
);
873879
});
874880
});
875881

0 commit comments

Comments
 (0)