mirror of
https://github.com/google/blockly.git
synced 2026-01-13 20:07:08 +01:00
Add aria-level and aria-selected attrs to dropdowns.
This commit is contained in:
@@ -44,7 +44,8 @@ blocklyApp.FieldComponent = ng.core
|
||||
</label>
|
||||
<ol role="group">
|
||||
<li [id]="idMap[optionValue]" role="treeitem" *ngFor="#optionValue of getOptions()"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap[optionValue + 'Button'], 'blockly-button')">
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap[optionValue + 'Button'], 'blockly-button')"
|
||||
[attr.aria-level]="level" [attr.aria-selected]="field.getValue() == optionValue">
|
||||
<button [id]="idMap[optionValue + 'Button']" (click)="handleDropdownChange(field, optionValue)"
|
||||
[disabled]="disabled" tabindex="-1"
|
||||
[attr.aria-label]="optionText[optionValue] + ' Press Enter to select this value'">
|
||||
@@ -62,7 +63,7 @@ blocklyApp.FieldComponent = ng.core
|
||||
{{field.getText()}}
|
||||
</label>
|
||||
`,
|
||||
inputs: ['field', 'index', 'parentId', 'disabled', 'mainFieldId'],
|
||||
inputs: ['field', 'index', 'parentId', 'disabled', 'mainFieldId', 'level'],
|
||||
pipes: [blocklyApp.TranslatePipe]
|
||||
})
|
||||
.Class({
|
||||
|
||||
@@ -37,7 +37,8 @@ blocklyApp.WorkspaceTreeComponent = ng.core
|
||||
<template ngFor #inputBlock [ngForOf]="block.inputList" #i="index">
|
||||
<li role="treeitem" [id]="idMap['listItem' + i]" [attr.aria-level]="level + 1" *ngIf="inputBlock.fieldRow.length"
|
||||
[attr.aria-labelledBy]="generateAriaLabelledByAttr(idMap['fieldLabel' + i])">
|
||||
<blockly-field *ngFor="#field of inputBlock.fieldRow" [field]="field" [mainFieldId]="idMap['fieldLabel' + i]">
|
||||
<blockly-field *ngFor="#field of inputBlock.fieldRow" [field]="field" [mainFieldId]="idMap['fieldLabel' + i]"
|
||||
[level]="level + 2">
|
||||
</blockly-field>
|
||||
</li>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user