-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
DropDown: Labels unassociated from DropDown unless :editable="true" #4567
Comments
@mertsincan @melloware Does this work on the PrimeReact side? I don't think the Dropdown showcase has any examples with labels set up for them. |
I would assume PrimeReact has this same issue. |
@melloware You assume wrongly ;) Looks like it does actually work. I'll see if I can figure out what it's doing and how to port it over. https://stackblitz.com/edit/react-dzv6ot?file=src%2FApp.js |
Ha nice. PrimeVue code is more accurate though for ARIA so we need to study https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ to see how ARIA recommends handling the label focus |
Okay I did some digging and reading. I think ARIA won't necessarily apply here since it's a click action on the label; even the example in the w3 doesn't focus if you click the label. Without messing with the ARIA work that's already been done, I managed to come up with a Vue-y way of working around the issue, which is basically a click event on the label that calls the https://stackblitz.com/edit/a5syvg-y2q5df?file=src%2FApp.vue |
@FlipWarthog something clever that could be done in Dropdown itself is if |
Oh that's not a bad idea. Let me poke around with it and see what it does. |
@FlipWarthog I was able to get your example to work by calling DomHandler.focus in the focusDropdown method. I couldn't get access to |
@zachlearnscode Awesome. Yeah I don't think the chrome error will be solved. See this ticket from the PrimeFaces side for more info on that primefaces/primefaces#10254 |
@FlipWarthog Yeah... 'overly agressive warning' seems like the right way to put it. Let me know if can be of any more help. |
…ss :editable="true"
…ss :editable="true"
Describe the bug
I'm getting an 'orphaned form label' accessibility warning for label elementss associated with DropDown components. As a result of this issue, the label does not properly bring focus to a DropDown element. The issue resolves itself when :editable="true" is added to the DropDown. Discord user FlipWarthog helpfully pointed out that the browser renders and input element when :editable="true" is applied and renders a span otherwise, which appears to be the root cause of this issue.
NOTE: Feel free to change this to a feature request if that would be more appropriate.
Reproducer
https://stackblitz.com/edit/a5syvg?file=src%2FApp.vue
PrimeVue version
^3.31.x
Vue version
3.x
Language
ES6
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
Try to click the "Testing" label associated with the dropdown component and note that it doesn't bring focus to the input. Click the Testing 2 and Testing 3 labels on the other inputs and note that focus is brought properly to the related inputs. Add :editable="true" to the Testing dropdown. Click the label again, and note that focus is property brought to the input.
Expected behavior
A label that is properly associated with a dropdown component should bring focus to the input when clicked regardless of the value of the editable prop. Accessibility tools should not report an orphaned form label if a form label is properly coded/associated to a dropdown component.
The text was updated successfully, but these errors were encountered: