Skip to content

Commit

Permalink
refactor: cleanup no longer used button roles (#3401)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Feb 7, 2022
1 parent d5f2ee9 commit 8598db1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ class DatePickerOverlayContent extends ThemableMixin(DirMixin(PolymerElement)) {
<template>
<div
part="year-number"
role="button"
current$="[[_isCurrentYear(index)]]"
selected$="[[_isSelectedYear(index, selectedDate)]]"
>
Expand Down
2 changes: 1 addition & 1 deletion packages/date-picker/src/vaadin-date-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
<slot name="prefix" slot="prefix"></slot>
<slot name="input"></slot>
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
<div part="toggle-button" slot="suffix" role="button" aria-hidden="true"></div>
<div part="toggle-button" slot="suffix" aria-hidden="true"></div>
</vaadin-input-container>
<div part="helper-text">
Expand Down
30 changes: 1 addition & 29 deletions packages/date-picker/test/wai-aria.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import { activateScroller, getDefaultI18n, open } from './common.js';

describe('WAI-ARIA', () => {
describe('date picker', () => {
let datepicker, toggleButton, input, label, helper, error;
let datepicker, input, label, helper, error;

beforeEach(() => {
datepicker = fixtureSync(`<vaadin-date-picker helper-text="Week day" label="Date"></vaadin-date-picker>`);
toggleButton = datepicker.shadowRoot.querySelector('[part="toggle-button"]');
input = datepicker.inputElement;
label = datepicker.querySelector('[slot=label]');
error = datepicker.querySelector('[slot=error-message]');
Expand Down Expand Up @@ -43,23 +42,6 @@ describe('WAI-ARIA', () => {
expect(aria).to.include(error.id);
});

it('should have button roles on buttons', () => {
// Indicate icon buttons as clickable. Especially helpful on touch devices.
expect(toggleButton.getAttribute('role')).to.equal('button');
});

// TODO: clarify if this is still needed
it.skip('should have label properties on buttons', () => {
// Give spoken names for the icon buttons.
expect(toggleButton.getAttribute('aria-label')).to.equal('Calendar');
});

// TODO: clarify if this is still needed
it.skip('should have label properties on buttons in correct locale', () => {
datepicker.set('i18n.calendar', 'kalenteri');
expect(toggleButton.getAttribute('aria-label')).to.equal('kalenteri');
});

it('should set aria-haspopup attribute on the input', () => {
expect(input.getAttribute('aria-haspopup')).to.equal('dialog');
});
Expand Down Expand Up @@ -110,16 +92,6 @@ describe('WAI-ARIA', () => {
expect(scroller.getAttribute('aria-hidden')).to.equal('true');
});

it('should contain button role for years', () => {
// Indicate years as clickable.
const years = Array.from(yearScrollerContents).filter((el) => /\d+/.test(el.textContent));

expect(years).to.not.be.empty;
years.forEach((year) => {
expect(year.getAttribute('role')).to.equal('button');
});
});

it('should have hidden state for dots', () => {
// Do not speak dots between years.
const dots = Array.from(yearScrollerContents).map((el) => el.nextElementSibling);
Expand Down

0 comments on commit 8598db1

Please sign in to comment.