You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue was recently discussed in the Discussions, and I'm excited to finally create a PR addressing it. I’m creating this issue to provide context for the PR. While I believe this change aligns with the project’s goals, please feel free to decline it if it doesn't.
Introduction
The Dropdown component currently includes:
Hidden input element: Supports form submissions and focus events.
Hidden select element: Provides a combobox with the selected option for screen readers.
Visible span label or input element: Displays the selected option or serves as an editable input for searching options.
Problem
The current accessibility approach relies on two hidden elements: input and select, which makes it unnecessarily complex and less effective. This could be simplified by directly assigning the combobox role to the span label. Making this change would:
Improve labeling and accessibility.
Create clear relationships between elements.
Accurately represent states like disabled or invalid using aria attributes.
A similar approach is already implemented in PrimeVue, demonstrating its benefits. Applying this improvement to PrimeReact would enhance the user experience and bring it in line with your company's standards.
Testing challenges
The current implementation complicates testing and requires additional boilerplate with passing props through pt or creating a wrapper.
melloware
added
Type: Enhancement
Issue contains an enhancement related to a specific component. Additional functionality has been add
and removed
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
labels
Jan 8, 2025
Describe the bug
This issue was recently discussed in the Discussions, and I'm excited to finally create a PR addressing it. I’m creating this issue to provide context for the PR. While I believe this change aligns with the project’s goals, please feel free to decline it if it doesn't.
Introduction
The
Dropdown
component currently includes:Problem
The current accessibility approach relies on two hidden elements:
input
andselect
, which makes it unnecessarily complex and less effective. This could be simplified by directly assigning thecombobox
role to thespan
label. Making this change would:disabled
orinvalid
using aria attributes.A similar approach is already implemented in PrimeVue, demonstrating its benefits. Applying this improvement to PrimeReact would enhance the user experience and bring it in line with your company's standards.
Testing challenges
The current implementation complicates testing and requires additional boilerplate with passing props through
pt
or creating a wrapper.Common test cases:
Finding the dropdown using the
combobox
role:This fails because the label is tied to the hidden input, which has the
textbox
role.Clicking on the dropdown to open the menu:
This fails because the input is hidden and not clickable as the element inherits
pointer-events: none
, even withcombobox
role.Finding the menu using the associated label:
This fails because the list isn’t bound to the input using
aria-controls
, despite documentation suggesting otherwise.Reproducer
https://stackblitz.com/edit/vitejs-vite-7rwuaddq?file=src%2FApp.test.tsx
System Information
Steps to reproduce the behavior
npm test
in the terminalExpected behavior
role="combobox"
is assigned directly to the visible span label or an editable input element and the redundant hidden select element is deprecated.The text was updated successfully, but these errors were encountered: