From 8600e6bd085d667b61ef8425ae496b15a1a7f5f7 Mon Sep 17 00:00:00 2001 From: knknk98 <65712721+knknk98@users.noreply.github.com> Date: Mon, 24 Jan 2022 21:47:43 +0900 Subject: [PATCH] fix(VCalendar): add "role" to monthly calendar fixes #14604 --- .../src/components/VCalendar/VCalendar.ts | 3 + .../components/VCalendar/VCalendarWeekly.ts | 12 + .../__snapshots__/VCalendar.spec.ts.snap | 220 +++++++++++++----- 3 files changed, 180 insertions(+), 55 deletions(-) diff --git a/packages/vuetify/src/components/VCalendar/VCalendar.ts b/packages/vuetify/src/components/VCalendar/VCalendar.ts index 0ad35201897..61e6ef03bc0 100644 --- a/packages/vuetify/src/components/VCalendar/VCalendar.ts +++ b/packages/vuetify/src/components/VCalendar/VCalendar.ts @@ -361,6 +361,9 @@ export default CalendarWithEvents.extend({ weekdays, categories, }, + attrs: { + role: 'grid', + }, directives: [{ modifiers: { quiet: true }, name: 'resize', diff --git a/packages/vuetify/src/components/VCalendar/VCalendarWeekly.ts b/packages/vuetify/src/components/VCalendar/VCalendarWeekly.ts index 752fc8c03b2..924cc5d4392 100644 --- a/packages/vuetify/src/components/VCalendar/VCalendarWeekly.ts +++ b/packages/vuetify/src/components/VCalendar/VCalendarWeekly.ts @@ -90,6 +90,9 @@ export default CalendarBase.extend({ genHead (): VNode { return this.$createElement('div', { staticClass: 'v-calendar-weekly__head', + attrs: { + role: 'row', + }, }, this.genHeadDays()) }, genHeadDays (): VNode[] { @@ -111,6 +114,9 @@ export default CalendarBase.extend({ key: day.date, staticClass: 'v-calendar-weekly__head-weekday', class: this.getRelativeClasses(day, outside), + attrs: { + role: 'columnheader', + }, }), this.weekdayFormatter(day, this.shortWeekdays)) }, genWeeks (): VNode[] { @@ -134,6 +140,9 @@ export default CalendarBase.extend({ return this.$createElement('div', { key: week[0].date, staticClass: 'v-calendar-weekly__week', + attrs: { + role: 'row', + }, }, weekNodes) }, getWeekNumber (determineDay: CalendarTimestamp) { @@ -159,6 +168,9 @@ export default CalendarBase.extend({ key: day.date, staticClass: 'v-calendar-weekly__day', class: this.getRelativeClasses(day, outside), + attrs: { + role: 'cell', + }, on: this.getDefaultMouseEventHandlers(':day', nativeEvent => { return { nativeEvent, ...day } }), diff --git a/packages/vuetify/src/components/VCalendar/__tests__/__snapshots__/VCalendar.spec.ts.snap b/packages/vuetify/src/components/VCalendar/__tests__/__snapshots__/VCalendar.spec.ts.snap index f8cf987e31a..55e5181a997 100644 --- a/packages/vuetify/src/components/VCalendar/__tests__/__snapshots__/VCalendar.spec.ts.snap +++ b/packages/vuetify/src/components/VCalendar/__tests__/__snapshots__/VCalendar.spec.ts.snap @@ -1,7 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`VCalendar should go to correct day when using next/prev public functions 1`] = ` -
+
@@ -307,7 +309,9 @@ exports[`VCalendar should go to correct day when using next/prev public function `; exports[`VCalendar should go to correct day when using next/prev public functions 2`] = ` -
+
@@ -613,7 +617,9 @@ exports[`VCalendar should go to correct day when using next/prev public function `; exports[`VCalendar should go to correct day when using next/prev public functions 3`] = ` -
+
@@ -919,7 +925,9 @@ exports[`VCalendar should go to correct day when using next/prev public function `; exports[`VCalendar should render 4-day view 1`] = ` -
+
@@ -1561,7 +1569,9 @@ exports[`VCalendar should render 4-day view 1`] = ` `; exports[`VCalendar should render day view 1`] = ` -
+
@@ -1867,32 +1877,54 @@ exports[`VCalendar should render day view 1`] = ` `; exports[`VCalendar should render month view 1`] = ` -
-
-
+
+
+
Sun
-
+
Mon
-
+
Tue
-
+
Wed
-
+
Thu
-
+
Fri
-
+
Sat
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+