Skip to content

feat(datepicker): add aria labels and aria level#2

Open
vbergeron-ls wants to merge 7 commits intomasterfrom
golf-3068-add-aria-labels-and-level-to-datepicker
Open

feat(datepicker): add aria labels and aria level#2
vbergeron-ls wants to merge 7 commits intomasterfrom
golf-3068-add-aria-labels-and-level-to-datepicker

Conversation

@vbergeron-ls
Copy link

@vbergeron-ls vbergeron-ls commented Feb 9, 2026

GOLF-3068

This PR adds:

  • Aria level to the month header of the datepicker
  • Aria labels to the arrow buttons of the datepicker, defaulting to "previous" and "next" when the new config options exposed for these are not specified.

No more role=heading and aria level
image

Aria labels passed as options
image

No aria label passed
image

<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>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed aria level and heading, confirmed no major change to css

@vbergeron-ls vbergeron-ls changed the title chore(build): add aria labels and aria level feat(datepicker): add aria labels and aria level Feb 9, 2026
@vbergeron-ls vbergeron-ls force-pushed the golf-3068-add-aria-labels-and-level-to-datepicker branch from 5332088 to ec3b34b Compare February 11, 2026 20:31
@ls-michael-smith ls-michael-smith self-assigned this Feb 12, 2026
Copy link

@ls-michael-smith ls-michael-smith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing I wonder is if we're going to get hit with some 'next year' vs 'next' issue.

@vbergeron-ls
Copy link
Author

vbergeron-ls commented Feb 12, 2026

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',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • does the datepicker limit to the next 20 years?
  • no translation supported I guess?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Yep because in years view, the grid displays 20 years at a time
  2. 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.

<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>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming tabindex="-1" was changed on purpose.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's a good catch actually it was not supposed to be changed.

<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>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same tabindex="-1">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants