Skip to content

Commit fe06f84

Browse files
authored
fix(ui5-date-*): components accessibility improved (#3163)
- ui5-date-picker: Replace aria-owns with aria-controls. - ui5-datetime-picker: Change aria-roledescription's value to Date Time Input - ui5-daterange-picker: Change aria-roledescription's value to Date Range Input Fixes #3002
1 parent f5e92e0 commit fe06f84

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

packages/main/src/DatePicker.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ class DatePicker extends DateComponentBase {
633633
"ariaHasPopup": "true",
634634
"ariaAutoComplete": "none",
635635
"role": "combobox",
636-
"ariaOwns": `${this._id}-responsive-popover`,
636+
"ariaControls": `${this._id}-responsive-popover`,
637637
"ariaExpanded": this.isOpen(),
638638
"ariaRequired": this.required,
639639
"ariaLabel": getEffectiveAriaLabelText(this),

packages/main/src/DateRangePicker.js

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
22
import CalendarDate from "@ui5/webcomponents-localization/dist/dates/CalendarDate.js";
33
import modifyDateBy from "@ui5/webcomponents-localization/dist/dates/modifyDateBy.js";
44
import getTodayUTCTimestamp from "@ui5/webcomponents-localization/dist/dates/getTodayUTCTimestamp.js";
5+
import { DATERANGE_DESCRIPTION } from "./generated/i18n/i18n-defaults.js";
56

67
// Styles
78
import DateRangePickerCss from "./generated/themes/DateRangePicker.css.js";
@@ -150,6 +151,10 @@ class DateRangePicker extends DatePicker {
150151
return this.placeholder !== undefined ? this.placeholder : `${this._displayFormat} ${this._effectiveDelimiter} ${this._displayFormat}`;
151152
}
152153

154+
get dateAriaDescription() {
155+
return this.i18nBundle.getText(DATERANGE_DESCRIPTION);
156+
}
157+
153158
/**
154159
* @override
155160
*/

packages/main/src/DateTimePicker.js

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import TimeSelection from "./TimeSelection.js";
1515
import {
1616
TIMEPICKER_SUBMIT_BUTTON,
1717
TIMEPICKER_CANCEL_BUTTON,
18+
DATETIME_DESCRIPTION,
1819
DATETIME_PICKER_DATE_BUTTON,
1920
DATETIME_PICKER_TIME_BUTTON,
2021
} from "./generated/i18n/i18n-defaults.js";
@@ -295,6 +296,10 @@ class DateTimePicker extends DatePicker {
295296
return super.phone || this._phoneMode;
296297
}
297298

299+
get dateAriaDescription() {
300+
return this.i18nBundle.getText(DATETIME_DESCRIPTION);
301+
}
302+
298303
/**
299304
* Defines whether the dialog on mobile should have header
300305
* @private

packages/main/src/Input.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
placeholder="{{_placeholder}}"
1919
maxlength="{{maxlength}}"
2020
role="{{accInfo.input.role}}"
21-
aria-owns="{{accInfo.input.ariaOwns}}"
21+
aria-controls="{{accInfo.input.ariaControls}}"
2222
?aria-invalid="{{accInfo.input.ariaInvalid}}"
2323
aria-haspopup="{{accInfo.input.ariaHasPopup}}"
2424
aria-describedby="{{accInfo.input.ariaDescribedBy}}"

packages/main/src/Input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ class Input extends UI5Element {
10931093
"ariaHasPopup": this._inputAccInfo.ariaHasPopup ? this._inputAccInfo.ariaHasPopup : ariaHasPopupDefault,
10941094
"ariaAutoComplete": this._inputAccInfo.ariaAutoComplete ? this._inputAccInfo.ariaAutoComplete : ariaAutoCompleteDefault,
10951095
"role": this._inputAccInfo && this._inputAccInfo.role,
1096-
"ariaOwns": this._inputAccInfo && this._inputAccInfo.ariaOwns,
1096+
"ariaControls": this._inputAccInfo && this._inputAccInfo.ariaControls,
10971097
"ariaExpanded": this._inputAccInfo && this._inputAccInfo.ariaExpanded,
10981098
"ariaDescription": this._inputAccInfo && this._inputAccInfo.ariaDescription,
10991099
"ariaLabel": (this._inputAccInfo && this._inputAccInfo.ariaLabel) || getEffectiveAriaLabelText(this),

packages/main/src/i18n/messagebundle.properties

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ DATEPICKER_OPEN_ICON_TITLE=Open Picker
6767
#XACT: Aria information for the Date Picker
6868
DATEPICKER_DATE_DESCRIPTION=Date Input
6969

70+
#XACT: Aria information for the Date Time Picker
71+
DATETIME_DESCRIPTION=Date Time Input
72+
73+
#XACT: Aria information for the Date Range Picker
74+
DATERANGE_DESCRIPTION=Date Range Input
75+
7076
DELETE=Delete
7177

7278
FILEUPLOAD_BROWSE=Browse...

0 commit comments

Comments
 (0)