Semantic-UI-React icon indicating copy to clipboard operation
Semantic-UI-React copied to clipboard

Allow Dropdowns to handle being focussed from a label

Open charliematters opened this issue 3 years ago • 2 comments

Feature Request

Problem description

Form selects don't focus themselves when clicking an associated label. There is a workaround for ones with a search prop, but seemingly no way of doing it for the others

Proposed solution

If a <Dropdown>, <Select> or <Form.Select> is passed an id prop, it should support focussing when clicking a label with a matching htmlFor prop, whether generated from the label field or otherwise

Demonstration of current behaviour:

https://codesandbox.io/s/semantic-ui-react-forked-3ey2b?file=/index.js

charliematters avatar Mar 01 '21 10:03 charliematters

Do you have a link to the workaround for "ones with a search prop" that you mentioned? This seems to impact testing with something like react-testing-library where ideally you select by label as well. And I would imagine accessibility as well.

bradleylandis avatar Sep 26 '23 16:09 bradleylandis

oh, I see the sandbox showed the workaround. thank you.

bradleylandis avatar Sep 26 '23 16:09 bradleylandis