-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow passing inputRef to RAC <Radio>
#6067
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good, couple small comments.
To your question about documentation. We'll need to change the type on RadioGroup to handle this. In React Spectrum side, we have a FocusableRef type which we can base a new type on over here. We don't want to actually use that type because it obscures access to the DOM Node itself in a way we don't want to do over here.
Thanks @sookmax for jumping on this! I'll try to test this shortly. It'd be great if you could add the edit to add: checking out the story now, it seems to work well but the focus lacks visual clarity without a focus ring. On inspection, the Dog label has the |
@snowystinger thanks for the feedback! I updated the story to include what you requested. Let me know if there's anything else I should add or change! radiogroup_focusable_ref_nerde.mov |
It seems like the default behavior per HTMLElement: focus() method: "By default the browser will scroll the element into view after focusing it, and it may also provide visible indication of the focused element (typically by displaying a "focus ring" around the element)." And so I thought calling
I think this is impossible though I'm not 100% sure. From my understanding, the |
<RadioGroup>
<RadioGroup>
<RadioGroup>
<Radio>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for the quick pivot!
Closes #6054, closes #6123
To implement the behavior described in #6054 (comment), I needed to passtabbable: true
togetFocusableTreeWalker()
. This behavior is tested by the unit test, but hard to tell in the story.Not sure if we still need to expose individualinputRef
s for each<Radio />
inside the group as done in #5967.Oh and should we document this behavior somewhere in the docs?Let me know what you guys think!This PR exposes
inputRef
through props in<Radio>
, practically the same as #5967.✅ Pull Request Checklist:
📝 Test Instructions:
Docs
inputRef
is in the prop table with the description "A ref for the HTML input element."🧢 Your Project: