Skip to content

Commit a5064cd

Browse files
authored
Scheduler a11y: fix appointment aria attrs (#28201)
1 parent fdc0f0e commit a5064cd

File tree

6 files changed

+61
-8
lines changed

6 files changed

+61
-8
lines changed

e2e/testcafe-devextreme/tests/scheduler/a11y/appointment.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,57 @@ fixture.disablePageReloads`a11y - appointment`
9595
],
9696
});
9797
});
98+
99+
test('appointments should have accessible info about reccurence', async (t) => {
100+
const scheduler = new Scheduler('#container');
101+
const recurrenceIcon = scheduler.getAppointment('Website Re-Design Plan').getRecurrenceElement();
102+
103+
await t
104+
.expect(recurrenceIcon.getAttribute('aria-label'))
105+
.eql('Recurring appointment');
106+
}).before(async () => {
107+
await createWidget('dxScheduler', {
108+
timeZone: 'America/Los_Angeles',
109+
dataSource: [
110+
{
111+
text: 'Website Re-Design Plan',
112+
startDate: new Date('2021-04-29T16:30:00.000Z'),
113+
endDate: new Date('2021-04-29T18:30:00.000Z'),
114+
recurrenceRule: 'FREQ=WEEKLY;BYDAY=MO,TH;COUNT=10',
115+
},
116+
],
117+
currentView,
118+
currentDate: new Date(2021, 3, 29),
119+
startDayHour: 9,
120+
});
121+
});
122+
123+
test('appointments should have right role', async (t) => {
124+
const scheduler = new Scheduler('#container');
125+
const appt = scheduler.getAppointment('Website Re-Design Plan');
126+
127+
await t
128+
.expect(appt.element.getAttribute('role'))
129+
.eql('application');
130+
131+
await t
132+
.expect(appt.element.getAttribute('aria-activedescendant'))
133+
.eql(null);
134+
}).before(async () => {
135+
await createWidget('dxScheduler', {
136+
timeZone: 'America/Los_Angeles',
137+
dataSource: [
138+
{
139+
text: 'Website Re-Design Plan',
140+
startDate: new Date('2021-04-29T16:30:00.000Z'),
141+
endDate: new Date('2021-04-29T18:30:00.000Z'),
142+
},
143+
],
144+
currentView,
145+
currentDate: new Date(2021, 3, 29),
146+
startDayHour: 9,
147+
});
148+
});
98149
});
99150

100151
[

e2e/testcafe-devextreme/tests/scheduler/dragAndDrop/T1080232.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test('it should correctly drag external item to the appointment after drag appoi
1919
.expect((await appt01.element.boundingClientRect).top)
2020
.eql(208)
2121
.dragToElement(dragItem, appt02.element, { speed: 0.5 })
22-
.expect(appt02.element.innerText)
22+
.expect(appt02.element.find('.dx-item-content').getAttribute('data-status'))
2323
.eql('Added');
2424
}).before(async () => {
2525
await appendElementTo('#container', 'div', 'list');
@@ -72,7 +72,7 @@ test('it should correctly drag external item to the appointment after drag appoi
7272
group: 'resourceGroup',
7373
data: [newData],
7474
onAdd: () => {
75-
element.text('Added');
75+
element.attr('data-status', 'Added');
7676
},
7777
});
7878
},

packages/devextreme/js/__internal/scheduler/appointments/m_appointment.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,8 @@ export class Appointment extends DOMComponent {
150150
this._renderDragSourceClass();
151151
this._renderDirection();
152152

153-
const text = ExpressionUtils.getField(this.option('dataAccessors'), 'text', this.rawAppointment);
154-
(this.$element() as any).attr('title', text);
155153
(this.$element() as any).data('dxAppointmentStartDate', this.option('startDate'));
156-
(this.$element() as any).attr('role', 'button');
154+
(this.$element() as any).attr('role', 'application');
157155

158156
this._renderRecurrenceClass();
159157
this._renderResizable();

packages/devextreme/js/__internal/scheduler/appointments/m_appointment_collection.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,10 @@ class SchedulerAppointments extends CollectionWidget {
328328
}
329329
}
330330

331+
_refreshActiveDescendant() {
332+
// override to do nothing
333+
}
334+
331335
_attachAppointmentsEvents() {
332336
(this as any)._attachClickEvent();
333337
(this as any)._attachHoldEvent();

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointments.tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ QUnit.module('Appointments', moduleOptions, () => {
549549
assert.strictEqual(deltaTime, -1800000, 'Delta time is OK');
550550
});
551551

552-
QUnit.test('Scheduler appointment should have aria-role \'button\'', function(assert) {
552+
QUnit.test('Scheduler appointment should have aria-role \'application\'', function(assert) {
553553
const item = {
554554
itemData: {
555555
text: 'Appointment 1',
@@ -565,7 +565,7 @@ QUnit.module('Appointments', moduleOptions, () => {
565565

566566
const $appointment = instance.$element().find('.dx-scheduler-appointment');
567567

568-
assert.equal($appointment.attr('role'), 'button', 'role is right');
568+
assert.equal($appointment.attr('role'), 'application', 'role is right');
569569
});
570570

571571
QUnit.test('Split appointment by day', function(assert) {

packages/testcafe-models/scheduler/appointment/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default class Appointment {
5757

5858
constructor(scheduler: Selector, index = 0, title?: string) {
5959
const element = scheduler.find(`.${CLASS.appointment}`);
60-
this.element = (title ? element.withAttribute('title', title) : element).nth(index);
60+
this.element = (title ? element.withText(title) : element).nth(index);
6161

6262
const appointmentContentDate = this.element.find(`.${CLASS.appointmentContentDate}`);
6363

0 commit comments

Comments
 (0)