From 49ee88ed35349d980e53b993e0cfc4e53e4d206d Mon Sep 17 00:00:00 2001 From: Ilya Tarusin Date: Wed, 25 Apr 2018 17:59:13 +0300 Subject: [PATCH] feat(buttons): add aria-attributes (#4082) Closes #4068 --- .../demos/custom-checkbox-value/custom-checkbox-value.ts | 2 +- demo/src/ng-api-doc.ts | 4 ++-- src/buttons/button-checkbox.directive.ts | 4 +++- src/buttons/button-radio.directive.ts | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/demo/src/app/components/+buttons/demos/custom-checkbox-value/custom-checkbox-value.ts b/demo/src/app/components/+buttons/demos/custom-checkbox-value/custom-checkbox-value.ts index e7b1019c3b..c2aa0200b4 100644 --- a/demo/src/app/components/+buttons/demos/custom-checkbox-value/custom-checkbox-value.ts +++ b/demo/src/app/components/+buttons/demos/custom-checkbox-value/custom-checkbox-value.ts @@ -5,5 +5,5 @@ import { Component } from '@angular/core'; templateUrl: './custom-checkbox-value.html' }) export class DemoButtonsCustomCheckboxValueComponent { - singleModel: string = '1'; + singleModel = '1'; } diff --git a/demo/src/ng-api-doc.ts b/demo/src/ng-api-doc.ts index 84860602d3..003e3e89d9 100644 --- a/demo/src/ng-api-doc.ts +++ b/demo/src/ng-api-doc.ts @@ -151,13 +151,13 @@ export const ngdoc: any = { { "name": "btnCheckboxFalse", "defaultValue": "false", - "type": "any", + "type": "boolean", "description": "

Falsy value, will be set to ngModel

\n" }, { "name": "btnCheckboxTrue", "defaultValue": "true", - "type": "any", + "type": "boolean", "description": "

Truthy value, will be set to ngModel

\n" } ], diff --git a/src/buttons/button-checkbox.directive.ts b/src/buttons/button-checkbox.directive.ts index 1d866fb828..0628d5456e 100644 --- a/src/buttons/button-checkbox.directive.ts +++ b/src/buttons/button-checkbox.directive.ts @@ -30,7 +30,9 @@ export class ButtonCheckboxDirective implements ControlValueAccessor, OnInit { /** Falsy value, will be set to ngModel */ @Input() btnCheckboxFalse: any = false; - @HostBinding('class.active') state = false; + @HostBinding('class.active') + @HostBinding('attr.aria-pressed') + state = false; protected value: any; protected isDisabled: boolean; diff --git a/src/buttons/button-radio.directive.ts b/src/buttons/button-radio.directive.ts index e3370ff848..5c37ab9730 100644 --- a/src/buttons/button-radio.directive.ts +++ b/src/buttons/button-radio.directive.ts @@ -54,6 +54,7 @@ export class ButtonRadioDirective implements ControlValueAccessor, OnInit { } @HostBinding('class.active') + @HostBinding('attr.aria-pressed') get isActive(): boolean { return this.btnRadio === this.value; }