diff --git a/packages/base/src/util/isValidPropertyName.js b/packages/base/src/util/isValidPropertyName.js index 36054b67c917..76781ffa720c 100644 --- a/packages/base/src/util/isValidPropertyName.js +++ b/packages/base/src/util/isValidPropertyName.js @@ -1,12 +1,15 @@ +// Note: disabled is present in IE so we explicitly allow it here. +// Others, such as ariaLabel, we explicitly override, so valid too +const whitelist = ["disabled", "ariaLabel"]; + /** * Checks whether a property name is valid (does not collide with existing DOM API properties) - * Note: disabled is present in IE so we explicitly allow it here. * * @param name * @returns {boolean} */ const isValidPropertyName = name => { - if (name === "disabled") { + if (whitelist.includes(name)) { return true; } const classes = [ diff --git a/packages/main/src/Button.hbs b/packages/main/src/Button.hbs index bdfc9ab0a08c..99ef18e557d3 100644 --- a/packages/main/src/Button.hbs +++ b/packages/main/src/Button.hbs @@ -15,7 +15,7 @@ tabindex={{tabIndexValue}} aria-expanded="{{accInfo.ariaExpanded}}" aria-controls="{{accInfo.ariaControls}}" - aria-label="{{ariaLabelledByText}}" + aria-label="{{ariaLabelText}}" title="{{accInfo.title}}" part="button" > diff --git a/packages/main/src/Button.js b/packages/main/src/Button.js index 170f535c3922..bf76a35219dd 100644 --- a/packages/main/src/Button.js +++ b/packages/main/src/Button.js @@ -129,6 +129,18 @@ const metadata = { type: Boolean, }, + /** + * Defines the aria-label attribute for the button + * @type {String} + * @defaultvalue: "" + * @private + * @since 1.0.0-rc.7 + */ + ariaLabel: { + type: String, + defaultValue: undefined, + }, + /** * Receives id(or many ids) of the elements that label the button * @type {String} @@ -328,8 +340,12 @@ class Button extends UI5Element { }; } - get ariaLabelledByText() { + get ariaLabelText() { if (!this.ariaLabelledby) { + if (this.ariaLabel) { + return this.ariaLabel; + } + return undefined; } diff --git a/packages/main/test/pages/Button.html b/packages/main/test/pages/Button.html index 850113ca1db9..d33444b47b87 100644 --- a/packages/main/test/pages/Button.html +++ b/packages/main/test/pages/Button.html @@ -62,8 +62,8 @@

- Action Bar Button - + + Action Bar Button
@@ -71,10 +71,15 @@ Download Application From This Button + + Action Bar Button + + Action Bar Button +