Skip to content

fix(ui5-date-picker): input type is now conveyed #2628

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

Merged
merged 6 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 3 additions & 4 deletions packages/main/src/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import "@ui5/webcomponents-icons/dist/appointment-2.js";
import "@ui5/webcomponents-icons/dist/decline.js";
import CalendarSelection from "@ui5/webcomponents-base/dist/types/CalendarSelection.js";
import RenderScheduler from "@ui5/webcomponents-base/dist/RenderScheduler.js";
import { DATEPICKER_OPEN_ICON_TITLE, DATEPICKER_DATE_ACC_TEXT, INPUT_SUGGESTIONS_TITLE } from "./generated/i18n/i18n-defaults.js";
import { DATEPICKER_OPEN_ICON_TITLE, DATEPICKER_DATE_TYPE, INPUT_SUGGESTIONS_TITLE } from "./generated/i18n/i18n-defaults.js";
import Icon from "./Icon.js";
import Button from "./Button.js";
import ResponsivePopover from "./ResponsivePopover.js";
Expand Down Expand Up @@ -816,13 +816,12 @@ class DatePicker extends UI5Element {

get accInfo() {
return {
"ariaDescribedBy": `${this._id}-date`,
"ariaRoledescription": this.dateAriaDescription,
"ariaHasPopup": "true",
"ariaAutoComplete": "none",
"role": "combobox",
"ariaOwns": `${this._id}-responsive-popover`,
"ariaExpanded": this.isOpen(),
"ariaDescription": this.dateAriaDescription,
"ariaRequired": this.required,
"ariaLabel": getEffectiveAriaLabelText(this),
};
Expand Down Expand Up @@ -864,7 +863,7 @@ class DatePicker extends UI5Element {
}

get dateAriaDescription() {
return this.i18nBundle.getText(DATEPICKER_DATE_ACC_TEXT);
return this.i18nBundle.getText(DATEPICKER_DATE_TYPE);
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/Input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
?aria-invalid="{{accInfo.input.ariaInvalid}}"
aria-haspopup="{{accInfo.input.ariaHasPopup}}"
aria-describedby="{{accInfo.input.ariaDescribedBy}}"
aria-roledescription="{{accInfo.input.ariaRoledescription}}"
aria-autocomplete="{{accInfo.input.ariaAutoComplete}}"
aria-expanded="{{accInfo.input.ariaExpanded}}"
aria-label="{{accInfo.input.ariaLabel}}"
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@ class Input extends UI5Element {

return {
"input": {
"ariaRoledescription": this._inputAccInfo && this._inputAccInfo.ariaRoledescription || undefined,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an eslint rule enforcing () despite priority for this line.

If you want, you can create a git pre push hook with the following content to avoid pushing eslint problems:

#!/bin/sh
#
# To enable this hook, run this command from the root folder of the project
#   $ git config core.hooksPath .githooks

# git runs hooks in the root dir
yarn lint

image

"ariaDescribedBy": ariaDescribedBy || undefined,
"ariaInvalid": this.valueState === ValueState.Error ? "true" : undefined,
"ariaHasPopup": this._inputAccInfo.ariaHasPopup ? this._inputAccInfo.ariaHasPopup : ariaHasPopupDefault,
Expand Down
6 changes: 3 additions & 3 deletions packages/main/src/i18n/messagebundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ BUTTON_ARIA_TYPE_REJECT=Negative Action
#XACT: ARIA announcement for the emphasized button
BUTTON_ARIA_TYPE_EMPHASIZED=Emphasized

#XACT: Date
DATEPICKER_DATE_ACC_TEXT=Date

# Carousel of text
CAROUSEL_OF_TEXT=of

Expand All @@ -43,6 +40,9 @@ CAROUSEL_DOT_TEXT=Item {0} of {1} displayed
#XACT: DatePicker 'Open Picker' icon title
DATEPICKER_OPEN_ICON_TITLE=Open Picker

#XACT: Aria information for the Date Picker
DATEPICKER_DATE_TYPE=Date Type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why "Date Type", in UI5 the corresponding text is "Date Input"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is "Date Type" by specification. "Date Input" is legacy in the other project.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The text "Date Type" doesn't make any sense. What does it mean? What types of dates are there? Or is it "Type a date"? which is also strange. Please check with the specification owner what this means and what the logic is

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Vladi,

I'd agree that "Date Type" string should be changed, but that's based on different concerns - I'll explain.

The main usage of aria-roledescription is for developers to provide better localization(!) of an element's role (implicit or not). This means that despite its name, aria-roledescription doesn't actually supplement the original role with additional description, but rather replaces it in the final announcement. Such naming proves to be quite deceiving. Making things worse, previous JAWS 2019 builds had supplementary announcements, but fortunately JAWS 2019, JAWS 2021 and NVDA (all latest) are working as intended now.

As standard ARIA roles are often not fully suited for our OpenUI5 controls, which could be confusing for blind people when using our framework, we used to provide a "custom role" (often the control's name) in aria-describedby. With the introduction of aria-roledescription in ARIA 1.1, we decided to take advantage of that new attribute by moving any existing "custom roles" to it (and adding missing ones in the process).

Now, for most controls this transition went without a hitch. DatePicker however has a tiny detail - it deviates from its specification (which was correctly pointed out). It's original description was meant to be "Date Type", which would've been fine at the time (as aria-describedby is announced in addition to an element's role), but it'd lose is combobox context once moved to aria-roledescription. The reason why it never emerged as an issue after our transition is that we never changed it from "Date Input". Since we learnt the hard way that changing a single word (even with a synonym) often result in months of false-positive bug reports, as testers were used to expecting a certain speech output, a decision was made to migrate them as they are.

So I see three possible choices for now:

  • Date Type: Explained above, not valid.
  • Date Input: A tad better, but flawed too, as DatePicker is more than a regular date input. In addition to this, if a user decides to type a date in its <input>, there's probability DP's formatter will change it when focus moves. Having a input with different value than the entered one could be quite confusing. It would hold the same date though.
  • Date Picker: FIORITECHP1-12301's proposal and final recommendation. Such value seems superior to the other options and would be our go-to choice, with other datetime controls following such naming convention.

Still, being the framework owners, we'd always comply with your preferences. Whether this is a proposal you agree with or you wish to try out a different approach - please let us know and we'll implement accordingly.

Regards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed with the other accessibility experts - the text will be "Date Input"

Copy link
Contributor Author

@unazko unazko Jan 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Gerogi for the detailed explanation. I'll change the text to "Date Input" as a final decision for consistency with the other project.


DELETE=Delete

FILEUPLOAD_BROWSE=Browse...
Expand Down
2 changes: 2 additions & 0 deletions packages/main/test/specs/DatePicker.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ describe("Date Picker Tests", () => {

it("input renders", () => {
datepicker.id = "#dp";

assert.ok(datepicker.input.isDisplayedInViewport(), "input is rendered");
assert.ok(datepicker.innerInput.isDisplayedInViewport(), "inner input is rendered");
assert.strictEqual(datepicker.innerInput.getAttribute("aria-roledescription"), "Date Type", "aria-roledescription attribute is added.");
});

it("input receives value", () => {
Expand Down