downshift icon indicating copy to clipboard operation
downshift copied to clipboard

Menu blurs when opening an HTML select on Chrome

Open MaxLustig opened this issue 7 years ago • 1 comments

  • downshift version: 3.3.5
  • node version: 10.16.3
  • npm (or yarn) version: yarn 1.19.1

Relevant code or config

<Downshift>
  {({
    isOpen,
    getToggleButtonProps,
    getMenuProps,
  }) => (
    <div>
      <button {...getToggleButtonProps()}>Open</button>
      {isOpen && (
        <div {...getMenuProps()>
          <select>
            <option value="test">Test</option>
          </select>
        </div>
      )}
    </div>
  )}
</Downshift>

What you did:

Set up a downshift dropdown menu that contains, among other things, a select element. Opened up the dropdown menu, clicked on the select element.

What happened:

This triggered the dropdown menu to blur.

Reproduction repository:

Problem description:

I don't expect the menu to blur there on Chrome. It works as expected on Firefox.

Suggested solution:

Not sure if I'm missing props to add to the select menu. I looked through the render props documentation and I didn't see anything specific to select. getInputProps isn't compatible with select elements. Ideally it works as expected out of the box, or there is a getSelectProps render prop.

MaxLustig avatar Nov 06 '19 16:11 MaxLustig

Do you have a code sandbox to show this issue?

Can you stop the click event from propagating when clicking the select?

silviuaavram avatar Nov 13 '19 13:11 silviuaavram