From ba8551ff0f3bd17c547491c9705433a7cc81f069 Mon Sep 17 00:00:00 2001 From: Nayden Naydenov <31909318+nnaydenow@users.noreply.github.com> Date: Thu, 29 Jul 2021 17:54:33 +0300 Subject: [PATCH 1/2] chore(ui5-illustrated-message): import default illustration (#3570) --- packages/fiori/src/IllustratedMessage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/fiori/src/IllustratedMessage.js b/packages/fiori/src/IllustratedMessage.js index ee6e260e8b03..6fc05a7cf7a8 100644 --- a/packages/fiori/src/IllustratedMessage.js +++ b/packages/fiori/src/IllustratedMessage.js @@ -6,6 +6,7 @@ import { getI18nBundle, fetchI18nBundle } from "@ui5/webcomponents-base/dist/i18 import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; import IllustratedMessageTemplate from "./generated/templates/IllustratedMessageTemplate.lit.js"; import IllustrationMessageType from "./types/IllustrationMessageType.js"; +import "./illustrations/BeforeSearch.js"; // Styles import IllustratedMessageCss from "./generated/themes/IllustratedMessage.css.js"; From 42d3ed5388be41e6a60cba6ec63ef0c60780bd35 Mon Sep 17 00:00:00 2001 From: Filip Siderov Date: Fri, 30 Jul 2021 11:45:08 +0300 Subject: [PATCH 2/2] feat: implement assessibleNameRef for many components (#3442) Part of #3107 BREAKING CHANGE: The support for ```aria-labelledby``` have been deprecated in favour of new attribute ```accessible-name-ref``` for the following components: - ComboBox (Requested by SF #1916) - DatePicker (Requested by SF #2107) - Input (Requested #1866) - List (Requested by SF #1886) - Rating Indicator - Select (Requested by SF #2107) - StepInput (Implemented as part of the initial implementation #2804) - TextArea (Requested by SF #2107) - WizardStep (Implemented as part of the initial implementation #2400) The ```aria-labelledby``` has been deprecated for the following component: - Button (Requested by SF #1425) The ```accessible-name``` has been deprecated for the following components: - Link (Requested by SF #2356) Both ```aria-labelledby``` and ```accessible-name``` have been deprecated for the following components: - Card (Requested by CBC #2127) - CheckBox (Requested by SF #2265) --- packages/base/hash.txt | 2 +- packages/base/src/util/AriaLabelHelper.js | 4 +- packages/fiori/src/NotificationListItem.js | 2 +- packages/fiori/src/WizardStep.js | 5 +- packages/main/src/Button.hbs | 2 +- packages/main/src/Button.js | 17 -- packages/main/src/Card.hbs | 5 +- packages/main/src/Card.js | 31 +-- packages/main/src/CardHeader.js | 28 --- packages/main/src/CheckBox.hbs | 1 - packages/main/src/CheckBox.js | 36 +--- packages/main/src/ComboBox.js | 6 +- packages/main/src/DatePicker.js | 6 +- packages/main/src/Input.js | 6 +- packages/main/src/Link.js | 21 +- packages/main/src/List.js | 8 +- packages/main/src/Select.js | 6 +- packages/main/src/StepInput.js | 5 +- packages/main/src/TextArea.js | 6 +- packages/main/test/pages/Button.html | 6 +- packages/main/test/pages/Card.html | 184 ++++++++++-------- packages/main/test/pages/ComboBox.html | 2 +- packages/main/test/pages/DatePicker.html | 4 +- .../main/test/pages/DatePicker_test_page.html | 4 +- packages/main/test/pages/Input.html | 4 +- packages/main/test/pages/Link.html | 2 +- packages/main/test/pages/List_test_page.html | 2 +- packages/main/test/pages/Select.html | 2 +- packages/main/test/pages/TextArea.html | 2 +- packages/main/test/samples/Button.sample.html | 40 ++-- packages/main/test/samples/Label.sample.html | 16 +- packages/main/test/specs/Card.spec.js | 12 -- packages/main/test/specs/CheckBox.spec.js | 9 - packages/main/test/specs/Link.spec.js | 13 -- .../main/test/specs/MultiComboBox.spec.js | 4 +- 35 files changed, 184 insertions(+), 319 deletions(-) diff --git a/packages/base/hash.txt b/packages/base/hash.txt index d4c2bddc6733..b03e6c7f109f 100644 --- a/packages/base/hash.txt +++ b/packages/base/hash.txt @@ -1 +1 @@ -Jo7xX6Xqjqd/+p/wSl0hl57d8ng= +44n+tz3Upvb7fx9BuRR5JpZRssg= \ No newline at end of file diff --git a/packages/base/src/util/AriaLabelHelper.js b/packages/base/src/util/AriaLabelHelper.js index 1291e0a074dd..24fc3178fab2 100644 --- a/packages/base/src/util/AriaLabelHelper.js +++ b/packages/base/src/util/AriaLabelHelper.js @@ -1,7 +1,7 @@ import findNodeOwner from "./findNodeOwner.js"; const getEffectiveAriaLabelText = el => { - if (!el.ariaLabelledby) { + if (!el.accessibleNameRef) { if (el.accessibleName) { return el.accessibleName; } @@ -19,7 +19,7 @@ const getEffectiveAriaLabelText = el => { * @param {String} readyIds (Optional) Defines a string of elements ids. The text of these elements will be returned. If used you should provide either el or ownerDocument */ const getAriaLabelledByTexts = (el, ownerDocument, readyIds = "") => { - const ids = (readyIds && readyIds.split(" ")) || el.ariaLabelledby.split(" "); + const ids = (readyIds && readyIds.split(" ")) || el.accessibleNameRef.split(" "); const owner = ownerDocument || findNodeOwner(el); let result = ""; diff --git a/packages/fiori/src/NotificationListItem.js b/packages/fiori/src/NotificationListItem.js index 14bff2664680..2a3724152786 100644 --- a/packages/fiori/src/NotificationListItem.js +++ b/packages/fiori/src/NotificationListItem.js @@ -53,7 +53,7 @@ const metadata = { * @type {WrappingType} * @defaultvalue "None" * @public - * @since 1.0.0-rc.16 + * @since 1.0.0-rc.15 */ wrappingType: { type: WrappingType, diff --git a/packages/fiori/src/WizardStep.js b/packages/fiori/src/WizardStep.js index 55438f4f8827..34a8ce132f75 100644 --- a/packages/fiori/src/WizardStep.js +++ b/packages/fiori/src/WizardStep.js @@ -118,9 +118,10 @@ const metadata = { * Defines the aria-labelledby of the step. * @type {boolean} * @defaultvalue "" - * @private + * @public + * @since 1.0.0-rc.15 */ - ariaLabelledby: { + accessibleNameRef: { type: String, }, }, diff --git a/packages/main/src/Button.hbs b/packages/main/src/Button.hbs index b50dbe7fab2d..1d2519f3cf24 100644 --- a/packages/main/src/Button.hbs +++ b/packages/main/src/Button.hbs @@ -18,7 +18,7 @@ aria-expanded="{{accInfo.ariaExpanded}}" aria-controls="{{accInfo.ariaControls}}" aria-haspopup="{{accInfo.ariaHaspopup}}" - aria-label="{{ariaLabelText}}" + aria-label="{{accessibleName}}" title="{{accInfo.title}}" part="button" > diff --git a/packages/main/src/Button.js b/packages/main/src/Button.js index 5cfd7bbe2f78..f4dd6739c596 100644 --- a/packages/main/src/Button.js +++ b/packages/main/src/Button.js @@ -3,7 +3,6 @@ import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; import { isSpace, isEnter } from "@ui5/webcomponents-base/dist/Keys.js"; import { getFeature } from "@ui5/webcomponents-base/dist/FeaturesRegistry.js"; import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js"; -import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js"; import isLegacyBrowser from "@ui5/webcomponents-base/dist/isLegacyBrowser.js"; import { isPhone, isTablet } from "@ui5/webcomponents-base/dist/Device.js"; import ButtonDesign from "./types/ButtonDesign.js"; @@ -165,18 +164,6 @@ const metadata = { defaultValue: undefined, }, - /** - * Receives id(or many ids) of the elements that label the button - * @type {String} - * @defaultvalue "" - * @private - * @since 1.0.0-rc.7 - */ - ariaLabelledby: { - type: String, - defaultValue: "", - }, - /** * @type {String} * @defaultvalue "" @@ -443,10 +430,6 @@ class Button extends UI5Element { }; } - get ariaLabelText() { - return getEffectiveAriaLabelText(this); - } - static typeTextMappings() { return { "Positive": BUTTON_ARIA_TYPE_ACCEPT, diff --git a/packages/main/src/Card.hbs b/packages/main/src/Card.hbs index 56026d0f39a2..eab442e935f5 100644 --- a/packages/main/src/Card.hbs +++ b/packages/main/src/Card.hbs @@ -2,10 +2,7 @@ class="{{classes}}" dir="{{effectiveDir}}" role="region" - aria-label="{{ariaLabelText}}" - aria-labelledby="{{ariaLabelledByCard}}" -> - + aria-labelledby="{{ariaLabelledByCard}}"> {{#if hasHeader}}
diff --git a/packages/main/src/Card.js b/packages/main/src/Card.js index 2e3168aa9655..1bf88ab0d550 100644 --- a/packages/main/src/Card.js +++ b/packages/main/src/Card.js @@ -1,7 +1,6 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js"; import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js"; -import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js"; import CardTemplate from "./generated/templates/CardTemplate.lit.js"; import Icon from "./Icon.js"; @@ -48,32 +47,10 @@ const metadata = { }, properties: /** @lends sap.ui.webcomponents.main.Card.prototype */ { - /** - * Sets the accessible aria name of the component. - * - * @type {String} - * @public - * @since 1.0.0-rc.15 - * @defaultvalue "" - */ - accessibleName: { - type: String, - }, + }, + events: /** @lends sap.ui.webcomponents.main.Card.prototype */ { - /** - * Receives id(or many ids) of the elements that label the component - * - * @type {String} - * @defaultvalue "" - * @private - * @since 1.0.0-rc.9 - */ - ariaLabelledby: { - type: String, - defaultValue: "", - }, }, - events: /** @lends sap.ui.webcomponents.main.Card.prototype */ {}, }; /** @@ -138,10 +115,6 @@ class Card extends UI5Element { return !!this.header.length; } - get ariaLabelText() { - return getEffectiveAriaLabelText(this); - } - get ariaCardRoleDescription() { return this.i18nBundle.getText(ARIA_ROLEDESCRIPTION_CARD); } diff --git a/packages/main/src/CardHeader.js b/packages/main/src/CardHeader.js index 5edeb331b207..bf658ec13ecf 100644 --- a/packages/main/src/CardHeader.js +++ b/packages/main/src/CardHeader.js @@ -1,7 +1,6 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js"; import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js"; -import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js"; import { isSpace, isEnter } from "@ui5/webcomponents-base/dist/Keys.js"; import CardHeaderTemplate from "./generated/templates/CardHeaderTemplate.lit.js"; import Icon from "./Icon.js"; @@ -93,29 +92,6 @@ const metadata = { type: Boolean, }, - /** - * Defines the aria-label attribute for the component - * - * @type {String} - * @private - * @defaultvalue "" - */ - ariaLabel: { - type: String, - }, - - /** - * Receives id(or many ids) of the elements that label the component - * - * @type {String} - * @defaultvalue "" - * @private - */ - ariaLabelledby: { - type: String, - defaultValue: "", - }, - _headerActive: { type: Boolean, noAttribute: true, @@ -208,10 +184,6 @@ class CardHeader extends UI5Element { return this.interactive ? undefined : "3"; } - get ariaLabelText() { - return getEffectiveAriaLabelText(this); - } - get ariaCardHeaderRoleDescription() { return this.interactive ? this.i18nBundle.getText(ARIA_ROLEDESCRIPTION_INTERACTIVE_CARD_HEADER) : this.i18nBundle.getText(ARIA_ROLEDESCRIPTION_CARD_HEADER); } diff --git a/packages/main/src/CheckBox.hbs b/packages/main/src/CheckBox.hbs index 16da07d2e5f7..a9b8b5ac010a 100644 --- a/packages/main/src/CheckBox.hbs +++ b/packages/main/src/CheckBox.hbs @@ -4,7 +4,6 @@ aria-checked="{{ariaChecked}}" aria-readonly="{{ariaReadonly}}" aria-disabled="{{ariaDisabled}}" - aria-label="{{ariaLabelText}}" aria-labelledby="{{ariaLabelledBy}}" aria-describedby="{{ariaDescribedBy}}" tabindex="{{tabIndex}}" diff --git a/packages/main/src/CheckBox.js b/packages/main/src/CheckBox.js index 728525587877..8512804a87ce 100644 --- a/packages/main/src/CheckBox.js +++ b/packages/main/src/CheckBox.js @@ -2,7 +2,6 @@ import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js"; import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js"; import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js"; -import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js"; import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js"; import { getFeature } from "@ui5/webcomponents-base/dist/FeaturesRegistry.js"; import { isSpace, isEnter } from "@ui5/webcomponents-base/dist/Keys.js"; @@ -164,31 +163,6 @@ const metadata = { name: { type: String, }, - - /** - * Sets the accessible aria name of the component. - * - * @type {string} - * @defaultvalue undefined - * @public - * @since 1.0.0-rc.15 - */ - accessibleName: { - type: String, - defaultValue: undefined, - }, - - /** - * Receives id(or many ids) of the elements that label the checkbox - * @type {String} - * @defaultvalue "" - * @private - * @since 1.0.0-rc.9 - */ - ariaLabelledby: { - type: String, - defaultValue: "", - }, }, events: /** @lends sap.ui.webcomponents.main.CheckBox.prototype */ { @@ -365,20 +339,12 @@ class CheckBox extends UI5Element { return this.disabled ? "true" : undefined; } - get ariaLabelText() { - return getEffectiveAriaLabelText(this); - } - get ariaChecked() { return this.indeterminate && this.checked ? "mixed" : this.checked; } get ariaLabelledBy() { - if (!this.ariaLabelText) { - return this.text ? `${this._id}-label` : undefined; - } - - return undefined; + return this.text ? `${this._id}-label` : undefined; } get ariaDescribedBy() { diff --git a/packages/main/src/ComboBox.js b/packages/main/src/ComboBox.js index bebe535a36ab..3ac027656ea7 100644 --- a/packages/main/src/ComboBox.js +++ b/packages/main/src/ComboBox.js @@ -205,10 +205,10 @@ const metadata = { * Receives id(or many ids) of the elements that label the combo box * @type {String} * @defaultvalue "" - * @private - * @since 1.0.0-rc.8 + * @public + * @since 1.0.0-rc.15 */ - ariaLabelledby: { + accessibleNameRef: { type: String, defaultValue: "", }, diff --git a/packages/main/src/DatePicker.js b/packages/main/src/DatePicker.js index c57fdc99a7ad..c570959bedbf 100644 --- a/packages/main/src/DatePicker.js +++ b/packages/main/src/DatePicker.js @@ -181,10 +181,10 @@ const metadata = { * * @type {String} * @defaultvalue "" - * @private - * @since 1.0.0-rc.9 + * @public + * @since 1.0.0-rc.15 */ - ariaLabelledby: { + accessibleNameRef: { type: String, defaultValue: "", }, diff --git a/packages/main/src/Input.js b/packages/main/src/Input.js index 000fff5b73ee..6579e9707eb8 100644 --- a/packages/main/src/Input.js +++ b/packages/main/src/Input.js @@ -316,10 +316,10 @@ const metadata = { * * @type {String} * @defaultvalue "" - * @private - * @since 1.0.0-rc.8 + * @public + * @since 1.0.0-rc.15 */ - ariaLabelledby: { + accessibleNameRef: { type: String, defaultValue: "", }, diff --git a/packages/main/src/Link.js b/packages/main/src/Link.js index c602781e6720..faff676481b8 100644 --- a/packages/main/src/Link.js +++ b/packages/main/src/Link.js @@ -1,7 +1,7 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js"; import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js"; import { isSpace, isEnter } from "@ui5/webcomponents-base/dist/Keys.js"; -import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js"; +import { getAriaLabelledByTexts } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js"; import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js"; import LinkDesign from "./types/LinkDesign.js"; import WrappingType from "./types/WrappingType.js"; @@ -102,26 +102,15 @@ const metadata = { defaultValue: WrappingType.None, }, - /** - * Sets the accessible aria name of the component. - * - * @type {String} - * @public - * @since 1.0.0-rc.15 - */ - accessibleName: { - type: String, - }, - /** * Receives id(or many ids) of the elements that label the input * * @type {String} * @defaultvalue "" - * @private - * @since 1.0.0-rc.10 + * @public + * @since 1.0.0-rc.15 */ - ariaLabelledby: { + accessibleNameRef: { type: String, defaultValue: "", }, @@ -244,7 +233,7 @@ class Link extends UI5Element { } get ariaLabelText() { - return getEffectiveAriaLabelText(this); + return getAriaLabelledByTexts(this); } get hasLinkType() { diff --git a/packages/main/src/List.js b/packages/main/src/List.js index 5b5fbc56147b..a66f7920f0f8 100644 --- a/packages/main/src/List.js +++ b/packages/main/src/List.js @@ -215,10 +215,10 @@ const metadata = { * * @type {String} * @defaultvalue "" - * @private - * @since 1.0.0-rc.8 + * @public + * @since 1.0.0-rc.15 */ - ariaLabelledby: { + accessibleNameRef: { type: String, defaultValue: "", }, @@ -525,7 +525,7 @@ class List extends UI5Element { } get ariaLabelledBy() { - if (this.ariaLabelledby || this.accessibleName) { + if (this.accessibleNameRef || this.accessibleName) { return undefined; } diff --git a/packages/main/src/Select.js b/packages/main/src/Select.js index 929736c4393c..337263895ce0 100644 --- a/packages/main/src/Select.js +++ b/packages/main/src/Select.js @@ -188,10 +188,10 @@ const metadata = { * * @type {String} * @defaultvalue "" - * @private - * @since 1.0.0-rc.9 + * @public + * @since 1.0.0-rc.15 */ - ariaLabelledby: { + accessibleNameRef: { type: String, defaultValue: "", }, diff --git a/packages/main/src/StepInput.js b/packages/main/src/StepInput.js index c607df0ebb54..5bf534d3663a 100644 --- a/packages/main/src/StepInput.js +++ b/packages/main/src/StepInput.js @@ -202,9 +202,10 @@ const metadata = { * * @type {String} * @defaultvalue "" - * @private + * @public + * @since 1.0.0-rc.15 */ - ariaLabelledby: { + accessibleNameRef: { type: String, defaultValue: "", }, diff --git a/packages/main/src/TextArea.js b/packages/main/src/TextArea.js index 03a92c33b822..c63a165d41d3 100644 --- a/packages/main/src/TextArea.js +++ b/packages/main/src/TextArea.js @@ -227,10 +227,10 @@ const metadata = { * * @type {String} * @defaultvalue "" - * @private - * @since 1.0.0-rc.9 + * @public + * @since 1.0.0-rc.15 */ - ariaLabelledby: { + accessibleNameRef: { type: String, }, diff --git a/packages/main/test/pages/Button.html b/packages/main/test/pages/Button.html index 979585b2e3a7..6f32c3c73332 100644 --- a/packages/main/test/pages/Button.html +++ b/packages/main/test/pages/Button.html @@ -86,10 +86,10 @@ From This Button Action Bar Button - + - Action Bar Button - + Action Bar Button + diff --git a/packages/main/test/pages/Card.html b/packages/main/test/pages/Card.html index 1e1de1aa0c50..d2d31df00499 100644 --- a/packages/main/test/pages/Card.html +++ b/packages/main/test/pages/Card.html @@ -1,5 +1,6 @@ + @@ -96,49 +97,75 @@ slot="header" title-text="Linked activities (5)" subtitle-text="quick links"> - - Add activity - - - - - Increase customer satisfaction by 10% using marketing methods - - - Get 1000 survey responses to annual employee survey - - - + + + + Template Based Segmentation + Segmentation Models + + - - - - - Add activity - - - - - Increase customer satisfaction by 10% using marketing methods - - - Get 1000 survey responses to annual employee survey - - - + + + + + Template Based Segmentation + Segmentation Models + + -

Test accessibleName and ariaLabelledBy

- - + + + Add activity + + + + + Increase customer satisfaction by 10% using marketing methods + + + Get 1000 survey responses to annual employee survey + + + + + + + + Add activity + + + + + Increase customer satisfaction by 10% using marketing methods + + + Get 1000 survey responses to annual employee survey + + + + + + + + + Add activity + + + + + Increase customer satisfaction by 10% using marketing methods + + + Get 1000 survey responses to annual employee survey + + + + + + @@ -146,51 +173,42 @@

Test accessibleName and ariaLabelledBy


info text - - + + - -
- Test -
- - - Increase customer satisfaction by 10% using marketing methods - - - Get 1000 survey responses to annual employee survey - - -
+ +
+ Test +
+ + + Increase customer satisfaction by 10% using marketing methods + + + Get 1000 survey responses to annual employee survey + + +
- - - - Increase customer satisfaction by 10% using marketing methods - - - Get 1000 survey responses to annual employee survey - - - + + + + Increase customer satisfaction by 10% using marketing methods + + + Get 1000 survey responses to annual employee survey + + + - + - + + \ No newline at end of file diff --git a/packages/main/test/pages/ComboBox.html b/packages/main/test/pages/ComboBox.html index 319c30f6bd76..689a248abeb6 100644 --- a/packages/main/test/pages/ComboBox.html +++ b/packages/main/test/pages/ComboBox.html @@ -41,7 +41,7 @@
Select country: - + diff --git a/packages/main/test/pages/DatePicker.html b/packages/main/test/pages/DatePicker.html index 16ca65a26995..6cf9c5831f7c 100644 --- a/packages/main/test/pages/DatePicker.html +++ b/packages/main/test/pages/DatePicker.html @@ -113,11 +113,11 @@

1 year range

-

Test accessibleName and ariaLabelledBy

+

Test accessibleName and accessibleNameRef


info text - +
diff --git a/packages/main/test/pages/DatePicker_test_page.html b/packages/main/test/pages/DatePicker_test_page.html index cfba902ad5f2..5b264b31fa61 100644 --- a/packages/main/test/pages/DatePicker_test_page.html +++ b/packages/main/test/pages/DatePicker_test_page.html @@ -72,11 +72,11 @@

DatePicker with hide-week-numbers=true/false

-

Test accessibleName and ariaLabelledBy

+

Test accessibleName and accessibleNameRef


info text - +