-
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
Changes from 17 commits
767525a
2f2ba11
f722bb6
1357c13
849e594
bd9bf48
4b82ba5
f77bfb6
8d26917
a9235f7
fdd2118
af2422c
23be11a
4850ce6
3c71085
067dbaa
9d4f2db
874d752
6d1dc16
5ed53a2
70b5104
d6598da
0c842f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,16 +11,21 @@ | |
?disabled="{{disabled}}" | ||
?readonly="{{readonly}}" | ||
value-state="{{valueState}}" | ||
aria-autocomplete="none" | ||
aria-haspopup | ||
@ui5-change="{{_handleInputChange}}" | ||
@ui5-input="{{_handleInputLiveChange}}" | ||
data-sap-focus-ref | ||
._accInfo ="{{accInfo}}" | ||
> | ||
{{#unless readonly}} | ||
<ui5-icon | ||
slot="icon" | ||
src="sap-icon://appointment-2" | ||
class="{{classes.icon}} ui5-datepicker-icon" | ||
tabindex="-1" | ||
accessible-name="{{openIconTitle}}" | ||
show-tooltip | ||
@click="{{togglePicker}}" | ||
></ui5-icon> | ||
{{/unless}} | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Describer => Description |
||
<slot name="formSupport"></slot> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ import CalendarDate from "@ui5/webcomponents-base/dist/dates/CalendarDate.js"; | |
import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js"; | ||
import { isShow } from "@ui5/webcomponents-base/dist/events/PseudoEvents.js"; | ||
import "./icons/appointment-2.js"; | ||
import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js"; | ||
import { DATEPICKER_OPEN_ICON_TITLE, DATEPICKER_DATE_TYPE } from "./generated/i18n/i18n-defaults.js"; | ||
import Icon from "./Icon.js"; | ||
import Popover from "./Popover.js"; | ||
import Calendar from "./Calendar.js"; | ||
|
@@ -285,6 +287,8 @@ class DatePicker extends UI5Element { | |
onSelectedDatesChange: this._handleCalendarSelectedDatesChange.bind(this), | ||
selectedDates: [], | ||
}; | ||
|
||
this.i18nBundle = getI18nBundle("@ui5/webcomponents"); | ||
} | ||
|
||
onBeforeRendering() { | ||
|
@@ -397,6 +401,25 @@ class DatePicker extends UI5Element { | |
return this._oDateFormat; | ||
} | ||
|
||
get accInfo() { | ||
return { | ||
"ariaDescribedBy": `${this._id}-date`, | ||
"ariaHasPopup": "true", | ||
"ariaAutoComplete": "none", | ||
"roleAttribute": "combobox", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO just "role", they are all attributes |
||
"ariaOwns": `${this._id}-popover`, | ||
"ariaExpanded": this.isOpen(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. When the picker gets opened or closed |
||
}; | ||
} | ||
|
||
get openIconTitle() { | ||
return this.i18nBundle.getText(DATEPICKER_OPEN_ICON_TITLE); | ||
} | ||
|
||
get dateAriaDescriber() { | ||
return this.i18nBundle.getText(DATEPICKER_DATE_TYPE); | ||
} | ||
|
||
_getPopover() { | ||
return this.shadowRoot.querySelector("ui5-popover"); | ||
} | ||
|
@@ -544,6 +567,7 @@ class DatePicker extends UI5Element { | |
Popover.define(), | ||
Calendar.define(), | ||
Input.define(), | ||
fetchI18nBundle("@ui5/webcomponents"), | ||
]); | ||
|
||
super.define(...params); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,6 +220,10 @@ const metadata = { | |
_popover: { | ||
type: Object, | ||
}, | ||
|
||
_accInfo: { | ||
type: Object, | ||
}, | ||
}, | ||
events: /** @lends sap.ui.webcomponents.main.Input.prototype */ { | ||
/** | ||
|
@@ -581,17 +585,47 @@ class Input extends UI5Element { | |
} | ||
|
||
get ariaDescribedBy() { | ||
if (this._accInfo && this._accInfo.ariaDescribedBy) { | ||
return `${this.suggestionsTextId} ${this.valueStateTextId} ${this._accInfo.ariaDescribedBy}`.trim(); | ||
} | ||
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 commentThe 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; | ||
} | ||
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 commentThe 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; | ||
} | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Should be fine to return undefined, try Same for ariaOwns ariaExpanded |
||
return this._accInfo.roleAttribute; | ||
} | ||
return ""; | ||
} | ||
|
||
get ariaOwns() { | ||
if (this._accInfo && this._accInfo.ariaOwns) { | ||
return this._accInfo.ariaOwns; | ||
} | ||
return ""; | ||
} | ||
|
||
get ariaExpanded() { | ||
if (this._accInfo && this._accInfo.ariaExpanded !== undefined) { | ||
return this._accInfo.ariaExpanded; | ||
} | ||
return ""; | ||
} | ||
|
||
get hasValueState() { | ||
return this.valueState !== ValueState.None; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 |
||
DATEPICKER_DATE_TYPE=Date | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DATE_TYPE sounds inaccurate, maybe DATEPICKER_DATE_ACC_TEXT or something |
||
|
||
#XACT: DatePicker 'Open Picker' icon title | ||
DATEPICKER_OPEN_ICON_TITLE=Open Picker | ||
|
||
#XTXT | ||
ICON_ACTION_SETTINGS=Settings | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
@import "./InvisibleTextStyles.css"; | ||
|
||
:host(:not([hidden])) { | ||
display: inline-block; | ||
} | ||
|
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