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

autoplay attribute on videos is wrongly camel-cased #16762

Closed
rmfarrell opened this issue Sep 12, 2019 · 3 comments
Closed

autoplay attribute on videos is wrongly camel-cased #16762

rmfarrell opened this issue Sep 12, 2019 · 3 comments

Comments

@rmfarrell
Copy link

JSX ignores the HTML autoplay attribute and warns it should be autoPlay.

Camelcase here is incorrect. I should only expect to use camelcase if the attribute were hyphenated in vanilla HTML. Autoplay is one word both as an html attribute and according to English.

@kunukn
Copy link
Contributor

kunukn commented Sep 13, 2019

Here is the list of attribute names:
https://github.com/facebook/react/blob/master/packages/react-dom/src/shared/possibleStandardNames.js

The DOM Api method name for the video element is autoplay and I believe that would be more correct to use.

There seems be a convention of camel-casing the attribute names.
All the words starting with auto are camel-cased.

A change might require a breaking change unless it is backward compatible, meaning supporting both autoplay and autoPlay.

I don't know whether the ship has sailed and this is the idiomatic approach to follow or whether it is a good idea to be flexible and also allow autoplay.

@Dergash
Copy link

Dergash commented Sep 13, 2019

Hi @rmfarrell!
You can read the reasoning behind using camelcase here and specifically about autoplay here

@rmfarrell
Copy link
Author

rmfarrell commented Sep 13, 2019

I'd say accept both but deprecate the camel case way in a later version? camel case is for concatenating multi-word properties, but autoplay is one word. I was stuck for several minutes on this because there I would never have guessed that autoplay would be camel-cased just because it starts with "auto."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants