feat(datepicker): add aria labels and aria level#2
feat(datepicker): add aria labels and aria level#2vbergeron-ls wants to merge 7 commits intomasterfrom
Conversation
template/datepicker/day.html
Outdated
| <th colspan="{{::5 + showWeeks}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th> | ||
| <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="-1"><i aria-hidden="true" class="glyphicon glyphicon-chevron-right"></i><span class="sr-only">next</span></button></th> | ||
| <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="-1" aria-label="{{::previousButtonLabel}}"><i aria-hidden="true" class="glyphicon glyphicon-chevron-left"></i><span class="sr-only">{{::previousButtonLabel}}</span></button></th> | ||
| <th colspan="{{::5 + showWeeks}}"><button id="{{::uniqueId}}-title" role="heading" aria-level="5" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th> |
There was a problem hiding this comment.
I'm not sure about using an aria-level of 5 here now that we don't even have the chronogolf context... I will investigate removing the heading role or alternative solutions.
There was a problem hiding this comment.
Removed aria level and heading, confirmed no major change to css
5332088 to
ec3b34b
Compare
ls-michael-smith
left a comment
There was a problem hiding this comment.
Only thing I wonder is if we're going to get hit with some 'next year' vs 'next' issue.
@ls-michael-smith I don't want to expose 6 different configs (2 for each of month/year/years views), so I'm thinking of only using Previous/Next (so changing localization in the chronogolf repo). EDIT: actually I changed my mind and I think if we don't provide the context of month/year/years we'll still get flagged for accessibility so 6 config options it is. |
| ngModelOptions: {}, | ||
| nextMonthLabel: 'Next month', | ||
| nextYearLabel: 'Next year', | ||
| nextYearsLabel: 'Next 20 years', |
There was a problem hiding this comment.
- does the datepicker limit to the next 20 years?
- no translation supported I guess?
There was a problem hiding this comment.
- Yep because in years view, the grid displays 20 years at a time
- This is essentially the default value when nothing is provided to the datepicker (because this repo does not support localization) but we will provide localized labels from chronogolf.
template/datepicker/day.html
Outdated
| <th colspan="{{::5 + showWeeks}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="0"><strong>{{title}}</strong></button></th> | ||
| <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="0" aria-label="Next month"><i aria-hidden="true" class="glyphicon glyphicon-chevron-right"></i><span class="sr-only">next</span></button></th> | ||
| <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="0" aria-label="{{::previousMonthLabel}}"><i aria-hidden="true" class="glyphicon glyphicon-chevron-left"></i><span class="sr-only">{{::previousMonthLabel}}</span></button></th> | ||
| <th colspan="{{::5 + showWeeks}}"><button id="{{::uniqueId}}-title" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th> |
There was a problem hiding this comment.
Assuming tabindex="-1" was changed on purpose.
There was a problem hiding this comment.
Oh that's a good catch actually it was not supposed to be changed.
template/datepicker/month.html
Outdated
| <th colspan="{{::yearHeaderColspan}}"><button id="{{::uniqueId}}-title" role="heading" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="0"><strong>{{title}}</strong></button></th> | ||
| <th><button type="button" class="btn btn-default btn-sm pull-right uib-right" ng-click="move(1)" tabindex="0" aria-label="Next year"><i aria-hidden="true" class="glyphicon glyphicon-chevron-right"></i><span class="sr-only">next</span></i></button></th> | ||
| <th><button type="button" class="btn btn-default btn-sm pull-left uib-left" ng-click="move(-1)" tabindex="0" aria-label="{{::previousYearLabel}}"><i aria-hidden="true" class="glyphicon glyphicon-chevron-left"></i><span class="sr-only">{{::previousYearLabel}}</span></button></th> | ||
| <th colspan="{{::yearHeaderColspan}}"><button id="{{::uniqueId}}-title" aria-live="assertive" aria-atomic="true" type="button" class="btn btn-default btn-sm uib-title" ng-click="toggleMode()" ng-disabled="datepickerMode === maxMode" tabindex="-1"><strong>{{title}}</strong></button></th> |
GOLF-3068
This PR adds:
No more role=heading and aria level

Aria labels passed as options

No aria label passed
