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

feat(ui5-datepicker): implement ACC support #763

Merged
merged 23 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
767525a
feat: implement create control script
tsanislavgatev Aug 26, 2019
2f2ba11
fix: create control script pr notes fix
tsanislavgatev Aug 26, 2019
f722bb6
add console error on empty string for a name of component
tsanislavgatev Aug 28, 2019
1357c13
solve conflict
tsanislavgatev Aug 28, 2019
849e594
master update
tsanislavgatev Aug 28, 2019
bd9bf48
removed hungarian notation
tsanislavgatev Aug 28, 2019
4b82ba5
removed old component creation snippet file
tsanislavgatev Aug 28, 2019
f77bfb6
feat(ui5-tabcontainer): acc update
tsanislavgatev Aug 30, 2019
8d26917
merge conflict solve
tsanislavgatev Aug 30, 2019
a9235f7
merge conflict tags solve
tsanislavgatev Aug 30, 2019
fdd2118
feat(ui5-tabcontainer): update ACC of header and content
tsanislavgatev Aug 30, 2019
af2422c
feat(ui5-tabcontainer): update ACC of header and content
tsanislavgatev Aug 30, 2019
23be11a
Merge branch 'master' of https://github.com/tsanislavgatev/ui5-webcom…
tsanislavgatev Aug 30, 2019
4850ce6
Merge branch 'master' of https://github.com/tsanislavgatev/ui5-webcom…
tsanislavgatev Aug 30, 2019
3c71085
Merge branch 'master' of https://github.com/tsanislavgatev/ui5-webcom…
tsanislavgatev Aug 30, 2019
067dbaa
feat:(ui5-datepicker): update ACC of the component and input included
tsanislavgatev Sep 3, 2019
9d4f2db
Merge remote-tracking branch 'upstream/master'
tsanislavgatev Sep 3, 2019
874d752
Updating with comments from PR
tsanislavgatev Sep 3, 2019
6d1dc16
Update with notes from PR
tsanislavgatev Sep 4, 2019
5ed53a2
Improve of get methods for acc in input
tsanislavgatev Sep 5, 2019
70b5104
update with comments from pr
tsanislavgatev Sep 5, 2019
d6598da
changing the place of input parent information
tsanislavgatev Sep 10, 2019
0c842f7
update escaping information repeating
tsanislavgatev Sep 10, 2019
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
4 changes: 3 additions & 1 deletion packages/main/src/DatePicker.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
@ui5-change="{{_handleInputChange}}"
@ui5-input="{{_handleInputLiveChange}}"
data-sap-focus-ref
._inputAccInfo ="{{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}}
Expand All @@ -46,6 +49,5 @@
@ui5-selectedDatesChange="{{_calendar.onSelectedDatesChange}}"
></ui5-calendar>
</ui5-popover>

<slot name="formSupport"></slot>
</div>
25 changes: 25 additions & 0 deletions packages/main/src/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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_ACC_TEXT } from "./generated/i18n/i18n-defaults.js";
import Icon from "./Icon.js";
import Popover from "./Popover.js";
import Calendar from "./Calendar.js";
Expand Down Expand Up @@ -285,6 +287,8 @@ class DatePicker extends UI5Element {
onSelectedDatesChange: this._handleCalendarSelectedDatesChange.bind(this),
selectedDates: [],
};

this.i18nBundle = getI18nBundle("@ui5/webcomponents");
}

onBeforeRendering() {
Expand Down Expand Up @@ -397,6 +401,26 @@ class DatePicker extends UI5Element {
return this._oDateFormat;
}

get accInfo() {
return {
"ariaDescribedBy": `${this._id}-date`,
"ariaHasPopup": "true",
"ariaAutoComplete": "none",
"role": "combobox",
"ariaOwns": `${this._id}-popover`,
"ariaExpanded": this.isOpen(),
Copy link
Contributor

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?

Copy link
Member

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)

"ariaDescription": this.dateAriaDescription,
};
}

get openIconTitle() {
return this.i18nBundle.getText(DATEPICKER_OPEN_ICON_TITLE);
}

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

_getPopover() {
return this.shadowRoot.querySelector("ui5-popover");
}
Expand Down Expand Up @@ -544,6 +568,7 @@ class DatePicker extends UI5Element {
Popover.define(),
Calendar.define(),
Input.define(),
fetchI18nBundle("@ui5/webcomponents"),
]);

super.define(...params);
Expand Down
15 changes: 11 additions & 4 deletions packages/main/src/Input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
?required="{{required}}"
.value="{{value}}"
placeholder="{{inputPlaceholder}}"
aria-invalid="{{ariaInvalid}}"
aria-haspopup="{{ariaHasPopup}}"
aria-describedby="{{ariaDescribedBy}}"
aria-autocomplete="{{ariaAutoComplete}}"
role="{{accInfo.input.role}}"
aria-owns="{{accInfo.input.ariaOwns}}"
aria-invalid="{{accInfo.input.ariaInvalid}}"
aria-haspopup="{{accInfo.input.ariaHasPopup}}"
aria-describedby="{{accInfo.input.ariaDescribedBy}}"
aria-autocomplete="{{accInfo.input.ariaAutoComplete}}"
aria-expanded="{{accInfo.input.ariaExpanded}}"
@input="{{_handleInput}}"
@change="{{_handleChange}}"
data-sap-no-tab-ref
Expand All @@ -35,6 +38,10 @@
<span id="{{_id}}-suggestionsText" class="ui5-hidden-text">{{suggestionsText}}</span>
{{/if}}

{{#if accInfo.input.ariaDescribedBy}}
<span id="{{accInfo.input.ariaDescribedBy}}" class="ui5-hidden-text">{{accInfo.input.ariaDescription}}</span>
{{/if}}

{{#if hasValueState}}
<span id="{{_id}}-descr" class="ui5-hidden-text">{{valueStateText}}</span>
{{/if}}
Expand Down
41 changes: 26 additions & 15 deletions packages/main/src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,14 @@ const metadata = {
_popover: {
type: Object,
},

_inputAccInfo: {
type: Object,
},

_wrapperAccInfo: {
type: Object,
},
},
events: /** @lends sap.ui.webcomponents.main.Input.prototype */ {
/**
Expand Down Expand Up @@ -568,28 +576,31 @@ class Input extends UI5Element {
return this.type.toLowerCase();
}

get ariaInvalid() {
return this.valueState === ValueState.Error ? "true" : undefined;
}

get suggestionsTextId() {
return this.showSuggestions ? `${this._id}-suggestionsText` : "";
}
}

get valueStateTextId() {
return this.hasValueState ? `${this._id}-descr` : "";
}

get ariaDescribedBy() {
return `${this.suggestionsTextId} ${this.valueStateTextId}`.trim();
}

get ariaHasPopup() {
return this.showSuggestions ? "true" : undefined;
}

get ariaAutoComplete() {
return this.showSuggestions ? "list" : undefined;
get accInfo() {
const ariaHasPopupDefault = this.showSuggestions ? "true" : undefined;
const ariaAutoCompleteDefault = this.showSuggestions ? "list" : undefined;
return {
"wrapper": {
},
"input": {
"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 : ariaHasPopupDefault,
"ariaAutoComplete": this._inputAccInfo ? this._inputAccInfo.ariaAutoComplete : ariaAutoCompleteDefault,
"role": this._inputAccInfo && this._inputAccInfo.role,
"ariaOwns": this._inputAccInfo && this._inputAccInfo.ariaOwns,
"ariaExpanded": this._inputAccInfo && this._inputAccInfo.ariaExpanded,
"ariaDescription": this._inputAccInfo && this._inputAccInfo.ariaDescription,
},
};
}

get hasValueState() {
Expand Down
6 changes: 6 additions & 0 deletions packages/main/src/i18n/messagebundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ 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

#XACT: DatePicker 'Open Picker' icon title
DATEPICKER_OPEN_ICON_TITLE=Open Picker

#XTXT
ICON_ACTION_SETTINGS=Settings

Expand Down
2 changes: 2 additions & 0 deletions packages/main/src/themes/DatePicker.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "./InvisibleTextStyles.css";

:host(:not([hidden])) {
display: inline-block;
}
Expand Down