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.91k stars 831 forks source link

aria-controls should not point to unmounted elements #3242

Open dodomorandi opened 1 day ago

dodomorandi commented 1 day ago

Bug report

Current Behavior

The Popover, Dialog, Select, Menu, NavigationMenu and Collapsible components set the aria-controls attribute even when they are in the closed state.

Expected behavior

An aria-controls attribute should only be set when the related element is available in the DOM. Therefore the presence of the attribute should follow the open state.

Reproducible example

Suggested solution

The presence of the attribute should follow the open state of the component.