Skip to content

Commit 13fa590

Browse files
srietkerkjwunderl
andauthored
Gave blocks rendered in docs a readable aria label (#11015)
* gave blocks rendered in docs a readable aria label * Update pxtrunner/renderer.ts Co-authored-by: Joey Wunderlich <[email protected]> --------- Co-authored-by: Joey Wunderlich <[email protected]>
1 parent 2a1d317 commit 13fa590

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pxtrunner/renderer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,10 @@ function renderInlineBlocksAsync(options: BlocksRenderOptions): Promise<void> {
821821
if (info && r.apiInfo) {
822822
const symbolInfo = r.apiInfo.byQName[info.qName];
823823
if (symbolInfo && symbolInfo.attributes.help) {
824-
$newel = $(`<a class="ui link"/>`).attr("href", `/reference/${symbolInfo.attributes.help}`).append($newel);
824+
// Create accessible label for the link using a human-readable name
825+
const readableName = symbolInfo.name || symbolInfo.qName;
826+
const ariaLabel = lf("Documentation for {0} block", readableName);
827+
$newel = $(`<a class="ui link"/>`).attr("href", `/reference/${symbolInfo.attributes.help}`).attr("aria-label", ariaLabel).append($newel);
825828
}
826829
}
827830
$el.replaceWith($newel);

0 commit comments

Comments
 (0)