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

fix(datetimeinput): accessibility violation in date time input #3802

Merged
merged 1 commit into from
Jun 19, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5426,7 +5426,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/C
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-Card-toolbar"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -5586,7 +5586,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 1 - Watson IoT/C
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-Card-toolbar"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ export const defaultProps = {
relativeToLabel: 'Relative to',
absoluteLabel: 'Absolute',
startTimeLabel: 'Start time',
startAriaLabel: 'Date time start',
endAriaLabel: 'Date time end',
endTimeLabel: 'End time',
applyBtnLabel: 'Apply',
cancelBtnLabel: 'Cancel',
Expand Down Expand Up @@ -1083,7 +1085,7 @@ const DateTimePicker = ({
hideTooltip
iconDescription={mergedI18n.calendarLabel}
passive={false}
triggerId="test-trigger-id-2"
triggerId={`test-trigger-${id}`}
light={light}
menuOffset={{
top: menuOffsetTop,
Expand Down Expand Up @@ -1115,7 +1117,7 @@ const DateTimePicker = ({
(invalidRangeStartDate ? invalidDateWarningHeight : 0) -
(!hasTimeInput ? timeInputHeight : 0),
}}
role="listbox"
role="presentation"
onClick={(event) => event.stopPropagation()} // need to stop the event so that it will not close the menu
onKeyDown={(event) => event.stopPropagation()} // need to stop the event so that it will not close the menu
tabIndex="-1"
Expand Down Expand Up @@ -1315,13 +1317,15 @@ const DateTimePicker = ({
>
<DatePickerInput
labelText=""
aria-label={mergedI18n.startAriaLabel}
id={`${id}-date-picker-input-start`}
hideLabel
/>

{datePickerType === 'range' ? (
<DatePickerInput
labelText=""
aria-label={mergedI18n.endAriaLabel}
id={`${id}-date-picker-input-end`}
hideLabel
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ const defaultProps = {
absoluteLabel: 'Absolute',
startTimeLabel: 'Start time',
endTimeLabel: 'End time',
startAriaLabel: 'Date time start',
endAriaLabel: 'Date time end',
applyBtnLabel: 'Apply',
cancelBtnLabel: 'Cancel',
backBtnLabel: 'Back',
Expand Down Expand Up @@ -834,7 +836,7 @@ const DateTimePicker = ({
hideTooltip
iconDescription={mergedI18n.calendarLabel}
passive={false}
triggerId="test-trigger-id-2"
triggerId={`test-trigger-${id}`}
light={light}
menuOffset={{
top: menuOffsetTop,
Expand Down Expand Up @@ -862,7 +864,7 @@ const DateTimePicker = ({
height: customHeight,
maxHeight,
}}
role="listbox"
role="presentation"
onClick={(event) => event.stopPropagation()} // need to stop the event so that it will not close the menu
onKeyDown={(event) => event.stopPropagation()} // need to stop the event so that it will not close the menu
tabIndex="-1"
Expand Down Expand Up @@ -1054,11 +1056,13 @@ const DateTimePicker = ({
>
<DatePickerInput
labelText=""
aria-label={mergedI18n.startAriaLabel}
id={`${id}-date-picker-input-start`}
hideLabel
/>
<DatePickerInput
labelText=""
aria-label={mergedI18n.endAriaLabel}
id={`${id}-date-picker-input-end`}
hideLabel
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -219,7 +219,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -349,7 +349,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -462,7 +462,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker25"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -575,7 +575,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -700,7 +700,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -838,7 +838,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -951,7 +951,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -1075,7 +1075,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -1212,7 +1212,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down Expand Up @@ -1341,7 +1341,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 2 - Watson IoT E
aria-expanded={false}
aria-label="Calendar"
className="bx--tooltip__label"
id="test-trigger-id-2"
id="test-trigger-datetimepicker"
onBlur={[Function]}
onClick={[Function]}
onContextMenu={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9720,6 +9720,7 @@ Map {
"customRangeLabel": "Custom range",
"customRangeLinkLabel": "Custom Range",
"decrement": "Decrement",
"endAriaLabel": "Date time end",
"endTimeLabel": "End time",
"hours": "hours",
"increment": "Increment",
Expand All @@ -9736,6 +9737,7 @@ Map {
"relativeLabels": Array [],
"relativeToLabel": "Relative to",
"resetBtnLabel": "Clear",
"startAriaLabel": "Date time start",
"startTimeLabel": "Start time",
"timePickerInvalidText": undefined,
"toLabel": "to",
Expand Down