Notebooks A11Y: Add button role for Placeholder Links (#15851)

* Add button role

* Add aria-label

* localize aria label
This commit is contained in:
Chris LaFreniere
2021-06-23 16:48:01 -07:00
committed by GitHub
parent a180a6bc47
commit f7a723d98d
2 changed files with 9 additions and 1 deletions

View File

@@ -7,7 +7,7 @@
<div style="overflow: hidden; width: 100%; height: 100%; display: flex; flex-flow: column">
<div class="placeholder-cell-component" style="flex: 0 0 auto;">
<div class="placeholder-cell-component text">
<p>{{clickOn}} <a id="addCode" href="#" (click)="addCell('code', $event)">{{plusCode}}</a> {{or}} <a id="addMarkdown" href="#" (click)="addCell('markdown', $event)">{{plusText}}</a> {{toAddCell}}</p>
<p>{{clickOn}} <a id="addCode" href="#" role="button" [attr.aria-label]=plusCodeAriaLabel (click)="addCell('code', $event)">{{plusCode}}</a> {{or}} <a id="addMarkdown" href="#" role="button" [attr.aria-label]=plusTextAriaLabel (click)="addCell('markdown', $event)">{{plusText}}</a> {{toAddCell}}</p>
</div>
</div>
</div>

View File

@@ -68,6 +68,14 @@ export class PlaceholderCellComponent extends CellView implements OnInit, OnChan
return localize('toAddCell', "to add a code or text cell");
}
get plusCodeAriaLabel(): string {
return localize('plusCodeAriaLabel', "Add a code cell");
}
get plusTextAriaLabel(): string {
return localize('plusTextAriaLabel', "Add a text cell");
}
public addCell(cellType: string, event?: Event): void {
if (event) {
event.preventDefault();