-
Notifications
You must be signed in to change notification settings - Fork 272
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
feat(ui5-datepicker): implement ACC support #763
Conversation
packages/main/src/Input.js
Outdated
return this.showSuggestions ? "list" : undefined; | ||
} | ||
|
||
get roleAttribute() { | ||
if (this._accInfo && this._accInfo.roleAttribute) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fine to return undefined, try
return this._accInfo && this._accInfo.roleAttribute;
Same for ariaOwns ariaExpanded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, please ask Eli to test it too
packages/main/src/DatePicker.hbs
Outdated
@@ -46,6 +51,6 @@ | |||
@ui5-selectedDatesChange="{{_calendar.onSelectedDatesChange}}" | |||
></ui5-calendar> | |||
</ui5-popover> | |||
|
|||
<span id="{{_id}}-date" class="ui5-hidden-text">{{dateAriaDescriber}}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describer => Description
packages/main/src/DatePicker.js
Outdated
"ariaDescribedBy": `${this._id}-date`, | ||
"ariaHasPopup": "true", | ||
"ariaAutoComplete": "none", | ||
"roleAttribute": "combobox", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO just "role", they are all attributes
@@ -25,6 +25,12 @@ BUTTON_ARIA_TYPE_REJECT=Negative Action | |||
#XACT: ARIA announcement for the emphasized button | |||
BUTTON_ARIA_TYPE_EMPHASIZED=Emphasized | |||
|
|||
#XACT: Aria information for the Date Picker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for the translation team, they don't really know what this means, so simply put a text such as "Date" IMO
@@ -25,6 +25,12 @@ BUTTON_ARIA_TYPE_REJECT=Negative Action | |||
#XACT: ARIA announcement for the emphasized button | |||
BUTTON_ARIA_TYPE_EMPHASIZED=Emphasized | |||
|
|||
#XACT: Aria information for the Date Picker | |||
DATEPICKER_DATE_TYPE=Date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DATE_TYPE sounds inaccurate, maybe DATEPICKER_DATE_ACC_TEXT or something
"ariaAutoComplete": "none", | ||
"roleAttribute": "combobox", | ||
"ariaOwns": `${this._id}-popover`, | ||
"ariaExpanded": this.isOpen(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when the value of this.isOpen() is changed? Does something invalidate so that the component can be invalidated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the picker gets opened or closed this. _isPickerOpen
is mutated, which invalidates the ui5-datepicker
, and this.isOpen()
will return either true
, or false
when calculated for the HBS template upon rendering. (If that was the question)
packages/main/src/Input.js
Outdated
return `${this.suggestionsTextId} ${this.valueStateTextId}`.trim(); | ||
} | ||
|
||
get ariaHasPopup() { | ||
if (this._accInfo && this._accInfo.ariaHasPopup) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do one check less, as undefined is fine:
if (this._accInfo) {
return this._accInfo.ariaHasPopup;
}
packages/main/src/Input.js
Outdated
return this.showSuggestions ? "true" : undefined; | ||
} | ||
|
||
get ariaAutoComplete() { | ||
if (this._accInfo && this._accInfo.ariaAutoComplete) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above, you can do one check less, as undefined is fine:
if (this._accInfo) {
return this._accInfo. ariaAutoComplete;
}
packages/main/src/Input.js
Outdated
return { | ||
"wrapperAccInfo": { | ||
}, | ||
"inputAccInfo": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AccInfo is already in the name of the main object, so "input" and "wrapper" are enough here
accInfo.input.role f.e.
packages/main/src/Input.js
Outdated
"inputAccInfo": { | ||
"ariaDescribedBy": this._inputAccInfo ? `${this.suggestionsTextId} ${this.valueStateTextId} ${this._inputAccInfo.ariaDescribedBy}`.trim() : `${this.suggestionsTextId} ${this.valueStateTextId}`.trim(), | ||
"ariaInvalid": this.valueState === ValueState.Error ? "true" : undefined, | ||
"ariaHasPopup": this._inputAccInfo ? this._inputAccInfo.ariaHasPopup : () => { return this.showSuggestions ? "true" : undefined; }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO better to extract this as a const above
same for the other such lines, seems a bit too complex to read
packages/main/src/DatePicker.hbs
Outdated
@@ -11,16 +11,21 @@ | |||
?disabled="{{disabled}}" | |||
?readonly="{{readonly}}" | |||
value-state="{{valueState}}" | |||
aria-autocomplete="none" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the aria stuff from the ui5-input
packages/main/src/DatePicker.hbs
Outdated
@@ -46,6 +51,6 @@ | |||
@ui5-selectedDatesChange="{{_calendar.onSelectedDatesChange}}" | |||
></ui5-calendar> | |||
</ui5-popover> | |||
|
|||
<span id="{{_id}}-date" class="ui5-hidden-text">{{dateAriaDescription}}</span> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not being read out when it is outside the native input DOM. We should add it in the same shadow root as the native input element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything works as expected and it is being read out correctly. Just look at the comments, there are a few minor stuff which should be changed
Hi team, can you please review the PR.
Best Regards,
Tsani