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: rename aria-label to accessible-name #3449

Merged
merged 7 commits into from
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/base/hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dsWZPIURDa/FQdScEGl9wVxGL1Y=
fwIH67OLD+hDOagFf4EY7oyPVEs=
4 changes: 2 additions & 2 deletions packages/base/src/util/AriaLabelHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import findNodeOwner from "./findNodeOwner.js";

const getEffectiveAriaLabelText = el => {
if (!el.ariaLabelledby) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this line needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it is. Based on this check, getAriaLabelledByTexts(line 12) is called.

if (el.ariaLabel) {
return el.ariaLabel;
if (el.accessibleName) {
return el.accessibleName;
}

return undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/fiori/src/Timeline.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="ui5-timeline-root" @focusin={{_onfocusin}}>
<ul class="ui5-timeline-list" role="listbox" aria-live="polite" aria-label="{{ariaLabel}}">
<ul class="ui5-timeline-list" role="listbox" aria-live="polite" aria-label="{{accessibleName}}">
{{#each items}}
<li class="ui5-timeline-list-item" style="list-style-type: none;">
<slot name="{{this._individualSlot}}"></slot>
Expand Down
9 changes: 5 additions & 4 deletions packages/fiori/src/Wizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ const metadata = {
managedSlots: true,
properties: /** @lends sap.ui.webcomponents.fiori.Wizard.prototype */ {
/**
* Defines the aria-label text of the <code>ui5-wizard</code>.
* Sets the accessible aria name of the component.
*
* @type {String}
* @defaultvalue undefined
* @private
* @public
* @since 1.0.0-rc.15
*/
ariaLabel: {
accessibleName: {
type: String,
defaultValue: undefined,
},
Expand Down Expand Up @@ -805,7 +806,7 @@ class Wizard extends UI5Element {
}

get ariaLabelText() {
return this.ariaLabel || this.i18nBundle.getText(WIZARD_NAV_ARIA_ROLE_DESCRIPTION);
return this.accessibleName || this.i18nBundle.getText(WIZARD_NAV_ARIA_ROLE_DESCRIPTION);
}

get effectiveStepSwitchThreshold() {
Expand Down
8 changes: 5 additions & 3 deletions packages/fiori/src/WizardStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,14 @@ const metadata = {
},

/**
* Defines the aria-label of the step.
* Sets the accessible aria name of the component.
*
* @type {boolean}
* @defaultvalue ""
* @private
* @public
* @since 1.0.0-rc.15
*/
ariaLabel: {
accessibleName: {
type: String,
},

Expand Down
2 changes: 1 addition & 1 deletion packages/fiori/test/pages/FCL.html
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@
<ui5-title level="H5">Rating:</ui5-title>
<ui5-rating-indicator
id="productRating"
aria-label="Hello World"
accessible-name="Hello World"
value="3.5"
></ui5-rating-indicator>
</div>
Expand Down
81 changes: 81 additions & 0 deletions packages/fiori/test/samples/Bar2.sample.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<header>
<div class="control-header">Bar</div>
<div class="component-heading-since">
<span><!--since_tag_marker--></span>
</div>
</header>

<div class="component-package">@ui5/webcomponents-fiori</div>

<div class="control-tag">&lt;ui5-bar&gt;</div>

<section>
<h3>Header Bar</h3>
<div class="snippet">
<ui5-bar design="Header">
<ui5-button icon="home" title="Go home" design="Transparent" slot="startContent"></ui5-button>
<ui5-label id="basic-label">Header Title</ui5-label>
<ui5-button icon="action-settings" title="Go to settings" slot="endContent"></ui5-button>
</ui5-bar>
</div>
<pre class="prettyprint lang-html"><xmp>
<ui5-bar design="Header">
<ui5-button icon="home" title="Go home" design="Transparent" slot="startContent"></ui5-button>
<ui5-label>Header Title</ui5-label>
<ui5-button icon="action-settings" title="Go to settings" slot="endContent"></ui5-button>
</ui5-bar>
</xmp></pre>
</section>
<section>
<h3>Subheader Bar</h3>
<div class="snippet">
<ui5-bar design="Subheader">
<ui5-button icon="home" title="Go home" slot="startContent"></ui5-button>
<ui5-label id="basic-label">Subheader Title</ui5-label>
<ui5-button icon="action-settings" title="Go to settings" slot="endContent"></ui5-button>
</ui5-bar>
</div>
<pre class="prettyprint lang-html"><xmp>
<ui5-bar design="Subheader">
<ui5-button icon="home" title="Go home" slot="startContent"></ui5-button>
<ui5-label>Subheader Title</ui5-label>
<ui5-button icon="action-settings" title="Go to settings" slot="endContent"></ui5-button>
</ui5-bar>
</xmp></pre>
</section>
<section>
<h3>Footer Bar</h3>
<div class="snippet">
<ui5-bar design="Footer">
<ui5-button design="Positive" slot="endContent">Agree</ui5-button>
<ui5-button design="Negative" slot="endContent">Decline</ui5-button>
<ui5-button design="Transparent" slot="endContent">Cancel</ui5-button>
</ui5-bar>
</div>
<pre class="prettyprint lang-html"><xmp>
<ui5-bar design="Footer">
<ui5-button design="Positive" slot="endContent">Agree</ui5-button>
<ui5-button design="Negative" slot="endContent">Decline</ui5-button>
<ui5-button design="Transparent" slot="endContent">Cancel</ui5-button>
</ui5-bar>
</xmp></pre>
</section>
<section>
<h3>FloatingFooter Bar</h3>
<div class="snippet">
<ui5-bar design="FloatingFooter">
<ui5-button design="Positive" slot="endContent">Agree</ui5-button>
<ui5-button design="Negative" slot="endContent">Decline</ui5-button>
<ui5-button design="Transparent" slot="endContent">Cancel</ui5-button>
</ui5-bar>
</div>
<pre class="prettyprint lang-html"><xmp>
<ui5-bar design="FloatingFooter">
<ui5-button design="Positive" slot="endContent">Agree</ui5-button>
<ui5-button design="Negative" slot="endContent">Decline</ui5-button>
<ui5-button design="Transparent" slot="endContent">Cancel</ui5-button>
</ui5-bar>
</xmp></pre>
</section>

<!-- JSDoc marker -->
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ <h3>FlexibleColumnLayout - One Initial Column</h3>
<ui5-title level="H5">Rating:</ui5-title>
<ui5-rating-indicator
id="productRating"
aria-label="Hello World"
accessible-name="Hello World"
value="3.5"
></ui5-rating-indicator>
</div>
Expand Down
9 changes: 5 additions & 4 deletions packages/main/src/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,14 @@ const metadata = {
},

/**
* Defines the aria-label attribute for the button
* Sets the accessible aria name of the component.
*
* @type {String}
* @defaultvalue: ""
* @private
* @since 1.0.0-rc.7
* @public
* @since 1.0.0-rc.15
*/
ariaLabel: {
accessibleName: {
type: String,
defaultValue: undefined,
},
Expand Down
8 changes: 4 additions & 4 deletions packages/main/src/Card.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@ const metadata = {
},

/**
* Defines the aria-label attribute for the component
* Sets the accessible aria name of the component.
*
* @type {String}
* @since 1.0.0-rc.9
* @private
* @public
* @since 1.0.0-rc.15
* @defaultvalue ""
*/
ariaLabel: {
accessibleName: {
type: String,
},

Expand Down
9 changes: 5 additions & 4 deletions packages/main/src/CheckBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,14 @@ const metadata = {
},

/**
* Determines the <code>aria-label</code>, set on the component root tag.
* Sets the accessible aria name of the component.
*
* @type {string}
* @defaultvalue undefined
* @private
* @since 1.0.0-rc.8
* @public
* @since 1.0.0-rc.15
*/
ariaLabel: {
accessibleName: {
type: String,
defaultValue: undefined,
},
Expand Down
9 changes: 5 additions & 4 deletions packages/main/src/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,14 @@ const metadata = {
},

/**
* Defines the aria-label attribute for the combo box
* Sets the accessible aria name of the component.
*
* @type {String}
* @defaultvalue: ""
* @private
* @since 1.0.0-rc.8
* @public
* @since 1.0.0-rc.15
*/
ariaLabel: {
accessibleName: {
type: String,
defaultValue: undefined,
},
Expand Down
7 changes: 3 additions & 4 deletions packages/main/src/DatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,10 @@ const metadata = {
* Defines the aria-label attribute for the component.
*
* @type {String}
* @since 1.0.0-rc.9
* @private
* @defaultvalue ""
* @public
* @since 1.0.0-rc.15
*/
ariaLabel: {
accessibleName: {
type: String,
},

Expand Down
10 changes: 4 additions & 6 deletions packages/main/src/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,8 @@ const metadata = {
},

/**
* Defines the accessible name of the dialog when <code>header</code> slot is provided.
* <br><br>
* Sets the accessible aria name of the component.
*
* <b>Note:</b> If <code>aria-label</code> is provided, <code>accessibleName</code> will be ignored.

* @type {string}
* @defaultvalue ""
* @public
Expand Down Expand Up @@ -240,7 +237,7 @@ class Dialog extends Popup {
get _ariaLabelledBy() { // Required by Popup.js
let ariaLabelledById;

if (this.headerText !== "" && !this.ariaLabel) {
if (this.headerText !== "" && !this.accessibleName) {
ariaLabelledById = "ui5-popup-header-text";
}

Expand All @@ -253,7 +250,8 @@ class Dialog extends Popup {
if (this.header.length > 0 && !!this.accessibleName) {
ariaLabel = this.accessibleName;
}
return this.ariaLabel ? this.ariaLabel : ariaLabel;

return this.accessibleName ? this.accessibleName : ariaLabel;
}

get _ariaModal() { // Required by Popup.js
Expand Down
9 changes: 4 additions & 5 deletions packages/main/src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,13 @@ const metadata = {
},

/**
* Defines the aria-label attribute for the input
* Sets the accessible aria name of the component.
*
* @type {String}
* @since 1.0.0-rc.8
* @private
* @defaultvalue ""
* @public
* @since 1.0.0-rc.15
*/
ariaLabel: {
accessibleName: {
type: String,
},

Expand Down
9 changes: 4 additions & 5 deletions packages/main/src/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,13 @@ const metadata = {
},

/**
* Defines the aria-label attribute for the link.
* Sets the accessible aria name of the component.
*
* @type {String}
* @since 1.0.0-rc.10
* @private
* @defaultvalue ""
* @public
* @since 1.0.0-rc.15
*/
ariaLabel: {
accessibleName: {
type: String,
},

Expand Down
10 changes: 6 additions & 4 deletions packages/main/src/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,14 @@ const metadata = {
},

/**
* Sets the accessible aria name of the component.
*
* @type {String}
* @defaultvalue ""
* @private
* @since 1.0.0-rc.8
* @public
* @since 1.0.0-rc.15
*/
ariaLabel: {
accessibleName: {
type: String,
},

Expand Down Expand Up @@ -523,7 +525,7 @@ class List extends UI5Element {
}

get ariaLabelledBy() {
if (this.ariaLabelledby || this.ariaLabel) {
if (this.ariaLabelledby || this.accessibleName) {
return undefined;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Panel.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
icon="slim-arrow-right"
@click="{{_toggleButtonClick}}"
._buttonAccInfo="{{accInfo.button}}"
aria-label="{{accInfo.button.ariaLabelButton}}"
accessible-name="{{accInfo.button.ariaLabelButton}}"
></ui5-button>
{{else}}
<ui5-icon
Expand Down
2 changes: 2 additions & 0 deletions packages/main/src/Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ const metadata = {

/**
* Sets the accessible aria name of the component.
*
* @type {string}
* @defaultvalue ""
* @public
* @since 1.0.0-rc.15
*/
accessibleName: {
type: String,
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ class Popover extends Popup {
}

get _ariaLabelledBy() { // Required by Popup.js
return this.ariaLabel ? undefined : "ui5-popup-header";
return this.accessibleName ? undefined : "ui5-popup-header";
}

get _ariaModal() { // Required by Popup.js
Expand Down
Loading