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

Is it normal for no downshift event to fire on input focus?

dlong500 opened this issue · comments

  • downshift version: 8.3.2
  • node version: 20.11.1
  • npm (or yarn) version: yarn v1.22.19

Question:
Is it normal for no downshift event to fire on input focus? I don't see anything in the docs, and of course the stateReducer doesn't run with no state changing when the input is focused.

Is it expected that you would need to use the native onFocus event handler if you need to do something when the input receives focus? I'm simply wanting the menu to open when the input receives focus and the only way seems to be to call openMenu() using the native onFocus event. If that's the way it's designed then that's fine; it's just that I've got most of the functionality working with a combination of the stateReducer, onInputValueChange, and onSelectedItemChange.

Hi! I think you should check the v8 migration guide!

Long story short, the aria 1.2 pattern allows toggle on input click, but there's no default action on the focus action. You will find details in the guide so you can adapt as needed. Let us know if you have more questions, thanks!

Ah, thank you. I missed the migration guide info on this issue (partly because I was never using v7). The workaround I used is exactly what is mentioned in the guide to restore earlier behavior. Still not sure why the Focus event couldn't be returned even with the default behavior being changed in v8, but I'm satisfied with the workaround for my use case.