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

<sl-dialog> does not allow native radio group with no checked option to be focused with keyboard #2277

Open
esharri2 opened this issue Nov 20, 2024 · 2 comments
Labels
bug Things that aren't working right in the library. fixed-in-wa This issue has been fixed or isn't relevant to Web Awesome.

Comments

@esharri2
Copy link
Contributor

Describe the bug

If you use a native radio button group inside of the sl-dialog component, and there is no input with a checked attribute, it cannot be focused via the TAB key.

To Reproduce

Steps to reproduce the behavior:

  1. Use sl-dialog component
  2. Add a button and a native radio group inside the dialog
  3. Open the dialog and press TAB
  4. You will see focus move between the dialog close button and the button in the dialog, skipping the radio group

Demo

https://codepen.io/esharri2/pen/wvVbZXz

Screenshots

N/A

Browser / OS

  • OS: Windows
  • Browser: Chrome
  • Browser version: 130

Additional information

  • This bug does not occur if you are using the Shoelace radio components.
  • It looks like all of the radio inputs are considered untabbable by this line:
    if (tag === 'input' && el.getAttribute('type') === 'radio' && !el.hasAttribute('checked')) {
    .
  • Happy to work on a PR if you all think this is something to fix. Thanks!
@esharri2 esharri2 added the bug Things that aren't working right in the library. label Nov 20, 2024
@KonnorRogers
Copy link
Collaborator

🤔 Feels like it would need to check all radios based on [name] in the current rootNode and if none of them are checked, it would allow focusing the first. If the radio has no name, it should always be focusable.

This should also be el.checked and not el.hasAttribute("checked").

https://codepen.io/paramagicdev/pen/abegBQz

@claviska claviska added the fixed-in-wa This issue has been fixed or isn't relevant to Web Awesome. label Nov 20, 2024
@claviska
Copy link
Member

@KonnorRogers I added the fixed-in-wa label because we use <dialog> there and the problem doesn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library. fixed-in-wa This issue has been fixed or isn't relevant to Web Awesome.
Projects
None yet
Development

No branches or pull requests

3 participants