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

refactor: cleanup no longer used button roles #3401

Merged
merged 1 commit into from
Feb 7, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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