Skip to content

Commit c1baf99

Browse files
committed
Add aria-label for button-toggle
1 parent 1e0c1fc commit c1baf99

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/lib/button-toggle/button-toggle.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
[checked]="checked"
66
[disabled]="disabled || null"
77
[name]="name"
8+
[attr.aria-label]="ariaLabel"
9+
[attr.aria-labelledby]="ariaLabelledby"
810
(change)="_onInputChange($event)"
911
(click)="_onInputClick($event)">
1012

src/lib/button-toggle/button-toggle.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,17 @@ export class MdButtonToggleGroupMultiple extends _MdButtonToggleGroupMixinBase
277277
}
278278
})
279279
export class MdButtonToggle implements OnInit, OnDestroy {
280+
/**
281+
* Attached to the aria-label attribute of the host element. In most cases, arial-labelledby will
282+
* take precedence so this may be omitted.
283+
*/
284+
@Input('aria-label') ariaLabel: string = '';
285+
286+
/**
287+
* Users can specify the `aria-labelledby` attribute which will be forwarded to the input element
288+
*/
289+
@Input('aria-labelledby') ariaLabelledby: string | null = null;
290+
280291
/** Whether or not this button toggle is checked. */
281292
private _checked: boolean = false;
282293

0 commit comments

Comments
 (0)