Skip to content

How to pass useTextField props to parent element instead of input element in React form using React Aria? #4522

Answered by snowystinger
yaman3bd asked this question in Q&A
Discussion options

You must be logged in to vote

I don't quite understand how your ideal case works. What happens if you have multiple inputs in the group? How do you distinguish which message/label/etc gets applied to each input? The way each of those hooks (ie useTextfield) works, is it generates an id for the label, an id for the description, an ide for the error message. And then it applies all those ids to the field in their correct aria attributes. It also generates an id for the field, and applies it to the correct attributes for the label. So there is a lot of interconnectivity for it to be accessible.

I think instead of handling it at the group, you should create a common wrapper for each input. We do this in React Spectrum com…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@yaman3bd
Comment options

Answer selected by yaman3bd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants