Skip to content

Commit

Permalink
feat(datepicker): add aria-attributes (#4141)
Browse files Browse the repository at this point in the history
Closes #4132
  • Loading branch information
tarusin authored and valorkin committed Apr 5, 2018
1 parent a21d3e0 commit 20c6b87
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="input-group">
<input type="text" class="form-control" bsDatepicker #dp="bsDatepicker" [bsConfig]="bsConfig">
<div class="input-group-btn">
<button class="btn btn-success" (click)="dp.show() ">Open</button>
<button class="btn btn-success" (click)="dp.show()" [attr.aria-expanded]="dp.isOpen">Open</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[bsConfig]="{ dateInputFormat: 'YYYY-MM-DD' }">
</div>
<div class="col-xs-12 col-12 col-md-3 form-group">
<button class="btn btn-success" (click)="dpYMD.toggle()">Date Picker</button>
<button class="btn btn-success" (click)="dpYMD.toggle()" [attr.aria-expanded]="dpYMD.isOpen">Date Picker</button>
</div>
</div>
<br>
Expand All @@ -28,7 +28,7 @@
[bsConfig]="{ dateInputFormat: 'MM/DD/YYYY' }">
</div>
<div class="col-xs-12 col-12 col-md-3 form-group">
<button class="btn btn-success" (click)="dpMDY.toggle()">Date Picker</button>
<button class="btn btn-success" (click)="dpMDY.toggle()" [attr.aria-expanded]="dpMDY.isOpen">Date Picker</button>
</div>
</div>
<br>
Expand All @@ -45,7 +45,7 @@
[bsConfig]="{ dateInputFormat: 'MMMM Do YYYY, h:mm:ss a' }">
</div>
<div class="col-xs-12 col-12 col-md-3 form-group">
<button class="btn btn-success" (click)="dpFull.toggle()">Date Picker</button>
<button class="btn btn-success" (click)="dpFull.toggle()" [attr.aria-expanded]="dpFull.isOpen">Date Picker</button>
</div>
</div>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[bsValue]="bsValue">
</div>
<div class="col-xs-12 col-12 col-md-3 form-group">
<button class="btn btn-success" (click)="dp.toggle()">Date Picker</button>
<button class="btn btn-success" (click)="dp.toggle()" [attr.aria-expanded]="dp.isOpen">Date Picker</button>
</div>
</div>

Expand All @@ -18,6 +18,6 @@
<input class="form-control" #drp="bsDaterangepicker" bsDaterangepicker [(ngModel)]="bsRangeValue">
</div>
<div class="col-xs-12 col-12 col-md-3 form-group">
<button class="btn btn-success" (click)="drp.toggle()">Date Range Picker</button>
<button class="btn btn-success" (click)="drp.toggle()" [attr.aria-expanded]="drp.isOpen">Date Range Picker</button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
bsDatepicker>
</div>
<div class="col-xs-12 col-12 col-md-3 form-group">
<button class="btn btn-success" (click)="dp.toggle()">Date Picker</button>
<button class="btn btn-success" (click)="dp.toggle()" [attr.aria-expanded]="dp.isOpen">Date Picker</button>
</div>
</div>
<br>
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<div class="row">
<div class="col-xs-8 col-8 col-md-5 col-lg-4 form-group">
<input class="form-control" placeholder="Please choose a date" bsDatepicker [isOpen]="isOpen" />
<input class="form-control" placeholder="Please choose a date"
#dp="bsDatepicker" bsDatepicker [isOpen]="isOpen" />
</div>
<div class="col-xs-4 col-4 col-md-4 form-group">
<input class="btn btn-success" type="button" value="Toggle" (click)="isOpen = !isOpen">
<input class="btn btn-success" type="button" value="Toggle"
(click)="isOpen = !isOpen" [attr.aria-expanded]="dp.isOpen">
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<div class="col-xs-12 col-12 col-sm-8 form-group">
<input class="btn btn-success" type="button" (click)="dp.show()" value="Open">
<input class="btn btn-success" type="button" (click)="dp.hide()" value="Close">
<input class="btn btn-success" type="button" (click)="dp.toggle()" value="Toggle">
<input class="btn btn-success" type="button" (click)="dp.toggle()" [attr.aria-expanded]="dp.isOpen" value="Toggle">
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ import { Subscription } from 'rxjs/Subscription';
templateUrl: './bs-datepicker-view.html',
host: {
'(click)': '_stopPropagation($event)',
style: 'position: absolute; display: block;'
style: 'position: absolute; display: block;',
role: 'dialog',
'aria-label': 'calendar'
}
})
export class BsDatepickerContainerComponent extends BsDatepickerAbstractComponent
Expand Down
2 changes: 1 addition & 1 deletion src/datepicker/themes/bs/bs-datepicker-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="bs-datepicker-container">

<!--calendars-->
<div class="bs-calendar-container" [ngSwitch]="viewMode | async">
<div class="bs-calendar-container" [ngSwitch]="viewMode | async" role="application">
<!--days calendar-->
<div *ngSwitchCase="'day'">
<bs-days-calendar-view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { Subscription } from 'rxjs/Subscription';
templateUrl: './bs-datepicker-view.html',
host: {
'(click)': '_stopPropagation($event)',
style: 'position: absolute; display: block;'
style: 'position: absolute; display: block;',
role: 'dialog',
'aria-label': 'calendar'
}
})
export class BsDaterangepickerContainerComponent extends BsDatepickerAbstractComponent
Expand Down

0 comments on commit 20c6b87

Please sign in to comment.