-
-
Notifications
You must be signed in to change notification settings - Fork 833
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
Add ability to focus sl-radio-group dynamically #2192
Add ability to focus sl-radio-group dynamically #2192
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
To avoid confusion, since radio items also have a @KonnorRogers @lindsaym-fa what do you think? |
I see it as no different than |
That's a tough call... I'm inclined to agree with @KonnorRogers — focus within a radio group implies focus on the selected item, so I like the simplified semantics of Is the context of using |
It focuses the selected item OR the first unchecked item, if no selection is currently made. That's why it feels a bit different to me in this case. You can't focus the radio group itself, it will always be passing focus to another element. 😕 |
Calling the method As a developer building a form, I would expect that methods for the basic form building blocks behave the same. |
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.
Thanks for the PR. Just a couple nits and it's good to go!
…o 2186-add-focus-method-to-sl-radio-group
Relates to: #2186
This PR adds the ability to call a new
focus
method onSlRadioGroup
. It may be used in the following way:The following changes where made to accomplish this:
handleLabelClick
into a new, shared methodhandleFocus
. The logic was already there, but not reusable. I also opted to add another check to the original logic. Previously, it selected the checked item or the first item fromgetAllRadios
. This would have resulted in selecting a potentially disabled option, so I tried to harden this a bit.focus
, which now also accepts the optionalFocusOptions
, as the other components do and reuseshandleFocus
.Looking forward to your opinions @claviska @KonnorRogers