From ecfecc9bcb54b52ad834814e35ef8b576a986520 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Sat, 5 Mar 2016 20:51:38 -0600 Subject: [PATCH] chore(actionsheet): add aria labels to actionsheet --- ionic/components/action-sheet/action-sheet.ts | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ionic/components/action-sheet/action-sheet.ts b/ionic/components/action-sheet/action-sheet.ts index 8cbd08aba6..d1a8f7b6ff 100644 --- a/ionic/components/action-sheet/action-sheet.ts +++ b/ionic/components/action-sheet/action-sheet.ts @@ -164,8 +164,8 @@ export class ActionSheet extends ViewController { '
' + '
' + '
' + - '
{{d.title}}
' + - '
{{d.subTitle}}
' + + '
{{d.title}}
' + + '
{{d.subTitle}}
' + '
' + '
', host: { - 'role': 'dialog' + 'role': 'dialog', + '[attr.aria-labelledby]': 'hdrId', + '[attr.aria-describedby]': 'descId' }, directives: [NgFor, NgIf, Icon] }) class ActionSheetCmp { private d: any; + private descId: string; + private hdrId: string; + private id: number; constructor( private _viewCtrl: ViewController, @@ -201,6 +206,14 @@ class ActionSheetCmp { if (this.d.cssClass) { renderer.setElementClass(_elementRef.nativeElement, this.d.cssClass, true); } + + this.id = (++actionSheetIds); + if (this.d.title) { + this.hdrId = 'acst-hdr-' + this.id; + } + if (this.d.subTitle) { + this.descId = 'acst-subhdr-' + this.id; + } } onPageLoaded() { @@ -399,3 +412,5 @@ class ActionSheetWpSlideOut extends Transition { } } Transition.register('action-sheet-wp-slide-out', ActionSheetWpSlideOut); + +let actionSheetIds = -1;