Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecation for a Button created with a non-button element #3828

Merged
merged 2 commits into from Jan 18, 2017

Conversation

misteroneill
Copy link
Member

Remove deprecation for a Button created with a non-button element - throw instead.

Requirements Checklist

  • Feature implemented / Bug fixed
  • Reviewed by Two Core Contributors

@@ -26,24 +26,14 @@ class Button extends ClickableComponent {
* @method createEl
*/
createEl(tag = 'button', props = {}, attributes = {}) {
if (tag !== 'button') {
throw new Error('Buttons must be created with a "button" tag.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we even allow a tag to be passed in?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because createEl does by default. In my opinion, it would be strange to have a bunch of createEl methods, but only one that has a different signature.

Copy link
Contributor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reason for this was originally backwards compatibility. I wonder if we can now just ignore the passed in tag and and always create a button. We'd want to still log the warning, though. So, maybe just throwing is fine :)

@OwenEdwards thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we definitely want to accept props and attributes, I think, for custom buttons. But I suppose changing the signature isn't the worst thing in the world.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

making it would be good to not throw? Doesn't seem like a fatal error to me, but I could be persuaded either way.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. I could see just calling log.error in this case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were still a couple of components which are clickable <div>s instead of <button>s - one of them was the poster image (I don't remember the other). I'd been discouraged from making DOM changes, so I made this split to maintain DOM backward-compatibility while fixing problems in the JavaScript and allowing menu buttons to work correctly. Ultimately (in v6.0?) the clickable-component and the button components should be merged again, and the option to pass a tag removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are going to move this conversation over to: #3837

Copy link
Contributor

@brandonocasey brandonocasey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we are going to move the tag removal PR discussion to another issue, so this LGTM.

@@ -28,25 +28,11 @@ class Button extends ClickableComponent {
* @return {Element}
* The element that gets created.
*/
createEl(tag = 'button', props = {}, attributes = {}) {
createEl(props = {}, attributes = {}) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After some thought, I'm unsure whether we want to change the method signature altogether. It totally makes sense to me to ignore it and always create a button element but it feels weird for this method to have a different signature from all other createEls.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I'm going to roll that back.

@gkatsev gkatsev merged commit c340dbc into videojs:master Jan 18, 2017
@misteroneill misteroneill deleted the buttons-are-buttons branch January 19, 2017 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
6.0
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants