Skip to content

Commit

Permalink
fix: button aria-label fix, to make it more flexible
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Jan 31, 2019
1 parent 24f3cc3 commit f75d9dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/dnb-ui-lib/src/components/button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ exports[`Button component have to match default button snapshot 1`] = `
variant="primary"
>
<button
aria-label="This is a button title"
className="dnb-button dnb-button--primary dnb-button--icon-position-right dnb-button--has-text dnb-button--has-icon id class className"
disabled="disabled"
id="id"
Expand Down Expand Up @@ -123,7 +122,6 @@ exports[`Button component have to match href="..." snapshot 1`] = `
variant="primary"
>
<a
aria-label="This is a button title"
className="dnb-button dnb-button--primary dnb-button--icon-position-right dnb-button--has-text dnb-button--has-icon id class className dnb-no-anchor-underline dnb-no-anchor-hover"
disabled="disabled"
href="https://url"
Expand Down

0 comments on commit f75d9dc

Please sign in to comment.