radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
15.93k stars 833 forks source link

`ToggleGroup` is not focused when `Dialog` opens #3077

Open ItaiYosephi opened 3 months ago

ItaiYosephi commented 3 months ago

Bug report

Current Behavior

When opening a dialog with ToggleGroup being the first element, focus is applied to the next tabable element. seems like ToggleGroup start with tabindex="-1" and only after the first render it changes to 0

https://github.com/user-attachments/assets/f66f172e-b55c-4c93-a77b-b2012222ed12

Expected behavior

ToggleGroup should be focused when dialog opens.

Reproducible example

CodeSandbox Template

Suggested solution

Seems like it should start with tabindex="0" by deafult, please see this comment: https://github.com/ariakit/ariakit/issues/4055#issuecomment-2298796742