Open yvesgurcan opened 1 year ago
@yvesgurcan
The id
prop is used to assign an id
attribute to thecontainer element.
If you want to to set the id
attribute of the rendered <input>
element, consider using the inputId
prop.
Thank you for your answer. That's good to know!
It seems fair to assume that a prop called id
would be attributed to the input
tag rather than it's container. Can the name of the id
prop be changed to containerId
in the next major version to make the purpose of this prop more intuitive?
I've noticed that the way
react-select
imposes anid
ofreact-select-2-input
on theinput
tag prevents the use of the preferred method for WCAG to handle labels and input fields for accessibility purposes (https://www.w3.org/WAI/tutorials/forms/labels/#associating-labels-explicitly).The React code below:
Results in HTML similar to this:
For compliance with WCAG, the
id
should be on theinput
, not thediv
, but this is not possible withreact-select
.