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

Bug(useCombobox): Event "__input_blur__" being fired when input is clicked on.

hitarthdesai opened this issue · comments

  • downshift version: 6.1.11
  • node version: 18.16.0
  • npm (or yarn) version: 9.5.1

Relevant code or config

const {
...
} = useCombobox({
    ...
    stateReducer: (state, changes) => {
        console.log(changes.type)
        return state
    }
})

What you did:
I had a weird bug where clicking on the input will open the menu(my isOpen is a controlled prop) but then immediately close the menu. I experimented with setting isOpen to true on both onFocus and onClick which temporarily solved the problem, but that is not ideal.

What happened:
To look for a better fix to the bug, I tried seeing by the means of the stateReducer what events are fired when the input field is clicked and to my surprise, I saw "input_blur" in there, which should not be happening.

Reproduction repository:

Problem description: "input_blur" should not fire on mouse click on input field.

Suggested solution: None yet.

Seems like this was fixed in v7.6.0. For some reason, my UI library was running but my main web-app was using v6.