Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hide weekdays from assistive technologies (#4658) (CP: 23.2) #4662

Merged
merged 1 commit into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/date-picker/src/vaadin-month-calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ class MonthCalendar extends FocusMixin(ThemableMixin(PolymerElement)) {
is="dom-repeat"
items="[[_getWeekDayNames(i18n.weekdays, i18n.weekdaysShort, showWeekNumbers, i18n.firstDayOfWeek)]]"
>
<th role="columnheader" part="weekday" scope="col" abbr$="[[item.weekDay]]">[[item.weekDayShort]]</th>
<th role="columnheader" part="weekday" scope="col" abbr$="[[item.weekDay]]" aria-hidden="true">
[[item.weekDayShort]]
</th>
</template>
</tr>
</thead>
Expand Down
2 changes: 1 addition & 1 deletion packages/date-picker/test/basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ describe('basic features', () => {
it('should notify i18n mutation to children', () => {
const monthCalendar = overlayContent.$.monthScroller.querySelector('vaadin-month-calendar');
const weekdays = monthCalendar.$.monthGrid.querySelectorAll('[part="weekday"]:not(:empty)');
const weekdayTitles = Array.prototype.map.call(weekdays, (weekday) => weekday.textContent);
const weekdayTitles = Array.prototype.map.call(weekdays, (weekday) => weekday.textContent.trim());
expect(weekdayTitles).to.eql(['ma', 'ti', 'ke', 'to', 'pe', 'la', 'su']);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ snapshots["vaadin-month-calendar shadow default"] =
</th>
<th
abbr="Sunday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -72,6 +73,7 @@ snapshots["vaadin-month-calendar shadow default"] =
</th>
<th
abbr="Monday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -80,6 +82,7 @@ snapshots["vaadin-month-calendar shadow default"] =
</th>
<th
abbr="Tuesday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -88,6 +91,7 @@ snapshots["vaadin-month-calendar shadow default"] =
</th>
<th
abbr="Wednesday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -96,6 +100,7 @@ snapshots["vaadin-month-calendar shadow default"] =
</th>
<th
abbr="Thursday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -104,6 +109,7 @@ snapshots["vaadin-month-calendar shadow default"] =
</th>
<th
abbr="Friday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -112,6 +118,7 @@ snapshots["vaadin-month-calendar shadow default"] =
</th>
<th
abbr="Saturday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand Down Expand Up @@ -467,6 +474,7 @@ snapshots["vaadin-month-calendar shadow max date"] =
</th>
<th
abbr="Sunday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -475,6 +483,7 @@ snapshots["vaadin-month-calendar shadow max date"] =
</th>
<th
abbr="Monday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -483,6 +492,7 @@ snapshots["vaadin-month-calendar shadow max date"] =
</th>
<th
abbr="Tuesday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -491,6 +501,7 @@ snapshots["vaadin-month-calendar shadow max date"] =
</th>
<th
abbr="Wednesday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -499,6 +510,7 @@ snapshots["vaadin-month-calendar shadow max date"] =
</th>
<th
abbr="Thursday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -507,6 +519,7 @@ snapshots["vaadin-month-calendar shadow max date"] =
</th>
<th
abbr="Friday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -515,6 +528,7 @@ snapshots["vaadin-month-calendar shadow max date"] =
</th>
<th
abbr="Saturday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand Down Expand Up @@ -907,6 +921,7 @@ snapshots["vaadin-month-calendar shadow week numbers"] =
</th>
<th
abbr="Monday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -915,6 +930,7 @@ snapshots["vaadin-month-calendar shadow week numbers"] =
</th>
<th
abbr="Tuesday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -923,6 +939,7 @@ snapshots["vaadin-month-calendar shadow week numbers"] =
</th>
<th
abbr="Wednesday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -931,6 +948,7 @@ snapshots["vaadin-month-calendar shadow week numbers"] =
</th>
<th
abbr="Thursday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -939,6 +957,7 @@ snapshots["vaadin-month-calendar shadow week numbers"] =
</th>
<th
abbr="Friday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -947,6 +966,7 @@ snapshots["vaadin-month-calendar shadow week numbers"] =
</th>
<th
abbr="Saturday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand All @@ -955,6 +975,7 @@ snapshots["vaadin-month-calendar shadow week numbers"] =
</th>
<th
abbr="Sunday"
aria-hidden="true"
part="weekday"
role="columnheader"
scope="col"
Expand Down
6 changes: 3 additions & 3 deletions packages/date-picker/test/month-calendar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ describe('vaadin-month-calendar', () => {

it('should render days in correct order by default', () => {
const weekdays = monthCalendar.shadowRoot.querySelectorAll('[part="weekday"]:not(:empty)');
const weekdayTitles = Array.from(weekdays).map((weekday) => weekday.textContent);
const weekdayTitles = Array.from(weekdays).map((weekday) => weekday.textContent.trim());
expect(weekdayTitles).to.eql(['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']);
});

it('should render days in correct order by first day of week', async () => {
monthCalendar.set('i18n.firstDayOfWeek', 1); // Start from Monday.
await aTimeout();
const weekdays = monthCalendar.shadowRoot.querySelectorAll('[part="weekday"]:not(:empty)');
const weekdayTitles = Array.from(weekdays).map((weekday) => weekday.textContent);
const weekdayTitles = Array.from(weekdays).map((weekday) => weekday.textContent.trim());
expect(weekdayTitles).to.eql(['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']);
});

Expand Down Expand Up @@ -170,7 +170,7 @@ describe('vaadin-month-calendar', () => {

it('should render weekdays in correct locale', () => {
const weekdays = monthCalendar.shadowRoot.querySelectorAll('[part="weekday"]:not(:empty)');
const weekdayTitles = Array.from(weekdays).map((weekday) => weekday.textContent);
const weekdayTitles = Array.from(weekdays).map((weekday) => weekday.textContent.trim());
expect(weekdayTitles).to.eql(['ma', 'ti', 'ke', 'to', 'pe', 'la', 'su']);
});

Expand Down