diff --git a/packages/dnb-ui-lib/src/components/button/Button.js b/packages/dnb-ui-lib/src/components/button/Button.js index 7c0f79df75c..ba375bfe929 100644 --- a/packages/dnb-ui-lib/src/components/button/Button.js +++ b/packages/dnb-ui-lib/src/components/button/Button.js @@ -194,13 +194,15 @@ export default class Button extends PureComponent { className: classes, type, title: title || text, - ['aria-label']: title || text, id, disabled, onMouseOut: this.onMouseOutHandler, // for resetting the button to the default state onClick: this.onClickHandler, ...props } + if (!params['aria-label'] && !text && title) { + params['aria-label'] = title + } // also used for code markup simulation validateDOMAttributes(this.props, params) diff --git a/packages/dnb-ui-lib/src/components/button/__tests__/__snapshots__/Button.test.js.snap b/packages/dnb-ui-lib/src/components/button/__tests__/__snapshots__/Button.test.js.snap index 26c86065a2a..16aa6f0158c 100644 --- a/packages/dnb-ui-lib/src/components/button/__tests__/__snapshots__/Button.test.js.snap +++ b/packages/dnb-ui-lib/src/components/button/__tests__/__snapshots__/Button.test.js.snap @@ -22,7 +22,6 @@ exports[`Button component have to match default button snapshot 1`] = ` variant="primary" >