Skip to content

ref-04-tags-and-attributes.md. data-* and aria-* attrs not camel-… #7946

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

Closed
wants to merge 1 commit into from

Conversation

teameh
Copy link

@teameh teameh commented Oct 12, 2016

IMO it's not clear form the docs how I should pass aria-labelledby.

React supports all data-* and aria-* attributes as well as every attribute in the following lists.
Note:

This note about camel-case makes it look like it's also about the data-* and aria-* attributes while it's not. Users might think they should use it like ariaLabelledBy or aria-labelledBy while they shouldn't. I think this addition makes this more clear.

Copy link
Contributor

@aweary aweary left a comment

Choose a reason for hiding this comment

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

Looks good to me with that small nit 👍

@@ -47,7 +47,7 @@ React supports all `data-*` and `aria-*` attributes as well as every attribute i

> Note:
>
> All attributes are camel-cased and the attributes `class` and `for` are `className` and `htmlFor`, respectively, to match the DOM API specification.
> All attributes are camel-cased and the attributes `class` and `for` are `className` and `htmlFor`, respectively, to match the DOM API specification. Custom `data-*` and `aria-*` attributes should not be camel-cased.
Copy link
Contributor

Choose a reason for hiding this comment

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

Small nit: can you drop the word "Custom"?

@teameh
Copy link
Author

teameh commented Oct 12, 2016

Small nit: can you drop the word "Custom"?

Done and rebased.

@gaearon
Copy link
Collaborator

gaearon commented Oct 22, 2016

Thanks for the PR! We've been rewriting nearly every doc in #7864 and this was changed to:

In React, all DOM properties and attributes (including event handlers) should be camelCased. For example, the HTML attribute tabindex corresponds to the attribute tabIndex in React. The exception is aria-* and data-* attributes, which should be lowercased.

I'm sorry that I can't take your PR now that the old doc is gone, but thanks for raising this!

@gaearon gaearon closed this Oct 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants