unovue / radix-vue

Vue port of Radix UI Primitives. An open-source UI component library for building high-quality, accessible design systems and web apps.
https://radix-vue.com
MIT License
3.72k stars 233 forks source link

[Bug]: use `aria-hidden="true"`, not `aria-hidden=""` #1210

Closed stefanprobst closed 3 months ago

stefanprobst commented 3 months ago

Environment

Developement/Production OS: linux
Node version: 20.16.0
Package manager: pnpm@9.7.0
Radix Vue version: 1.9.3
Vue version: 3.4.37
Nuxt version: 3.12.4
CSS framework: tailwindcss@3.4.9
Client OS: linux
Browser: firefox

Link to minimal reproduction

https://github.com/stefanprobst/issue-shadcn-vue-checkbox

Steps to reproduce

Describe the bug

aria-hidden="" does not actually hide the element. when inspecting the <input type="checkbox"> in devtools, you will see two elements with role=checkbox, the <button role="checkbox"> and the <input type="checkbox" aria-hidden="">:

Screenshot_20240810_115623

when setting aria-hidden="true" on the input element, you will see:

Screenshot_20240810_115751

Expected behavior

No response

Context & Screenshots (if applicable)

the repro is for checkbox, but there may be other components affected as well.

maxmaxme commented 3 months ago

Hi! After the last update I get this error in the console when I try to use the Combobox

Blocked aria-hidden on a element because the element that just received focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden. <input type=​"text" aria-expanded=​"true" aria-controls=​"radix-vue-combobox-content-1" aria-disabled=​"false" aria-autocomplete=​"list" role=​"combobox" autocomplete=​"false" class=​"ComboboxInput" placeholder=​"Placeholder..." value aria-activedescendant=​"radix-vue-combobox-option-4">​

Screenshot 2024-08-14 at 14 48 34
zernonia commented 3 months ago

Thanks @maxmaxme ! I realized this issue too! Will push a fix soon!