Skip to content

Commit

Permalink
refactor: Buttons will always use a button element (#3828)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: button component will always use a button element.
  • Loading branch information
misteroneill authored and gkatsev committed Jan 18, 2017
1 parent 2014120 commit c340dbc
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/js/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ class Button extends ClickableComponent {
/**
* Create the `Button`s DOM element.
*
* @param {string} [tag=button]
* Element's node type. e.g. 'button'
* @param {string} [tag="button"]
* The element's node type. This argument is IGNORED: no matter what
* is passed, it will always create a `button` element.
*
* @param {Object} [props={}]
* An object of properties that should be set on the element.
Expand All @@ -28,25 +29,13 @@ class Button extends ClickableComponent {
* @return {Element}
* The element that gets created.
*/
createEl(tag = 'button', props = {}, attributes = {}) {
createEl(tag, props = {}, attributes = {}) {
tag = 'button';

props = assign({
className: this.buildCSSClass()
}, props);

if (tag !== 'button') {
log.warn(`Creating a Button with an HTML element of ${tag} is deprecated; use ClickableComponent instead.`);

// Add properties for clickable element which is not a native HTML button
props = assign({
tabIndex: 0
}, props);

// Add ARIA attributes for clickable element which is not a native HTML button
attributes = assign({
role: 'button'
}, attributes);
}

// Add attributes for button element
attributes = assign({

Expand Down

0 comments on commit c340dbc

Please sign in to comment.