downshift-js / downshift

🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.

Home Page:http://downshift-js.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Select element doesn't receive focus when the label is clicked.

dor-unit opened this issue · comments

  • downshift version: ^8.2.2
  • node version: v16.16.0
  • npm (or yarn) version: 8.5.5

Relevant code or config

What you did:

What happened:

Reproduction repository:

Problem description:
Clicking on the label does not give focus to the Select element. This issue is also replicated in the examples provided in the documentation.

Suggested solution:

Good point! Raised the topic with the ARIA folks, let's see if we can improve the default behaviour.

In the meanwhile, you can do a getLabelProps({onClick() { toggleButtonRef.current.focus(); }}) as a workaround, however I think this behaviour should be commonly agreed upon by ARIA. In any case, if you think it helps, go ahead and add the custom behaviour.