mirror of
https://github.com/videojs/video.js.git
synced 2025-01-15 10:39:58 +02:00
refactor: Buttons will always use a button element (#3828)
BREAKING CHANGE: button component will always use a button element.
This commit is contained in:
parent
20141202c1
commit
c340dbcccd
@ -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.
|
||||
@ -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({
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user