Semantic-Org / Semantic-UI-React

The official Semantic-UI-React integration
https://react.semantic-ui.com
MIT License
13.19k stars 4.04k forks source link

Allow Dropdowns to handle being focussed from a label #4162

Open charliematters opened 3 years ago

charliematters commented 3 years ago

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

bradleylandis commented 9 months ago

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 commented 9 months ago

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