Skip to content

onBlur never called when parent has been focused #6098

@arnauddrain

Description

@arnauddrain

Hi,

When the parent element of a ReactSelect has been focused, the onBlur is never called on ReactSelect, so clicking outside of the component never close the option menu.

It can be reproduced easily with this:

const nodeRef = useRef<HTMLDivElement | null>(null);
<div
  ref={nodeRef}
  tabIndex={0}
  onMouseDown={() => {
    nodeRef.current?.focus();
  }}
>
  <ReactSelect />
</div>

Another strange thing is that in this situation, onMenuClose is called when we open the menu for the first time, and it's not the case in regular situations.

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/bug-unconfirmedIssues that describe a bug that hasn't been confirmed by a maintainer yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions