fraserxu / react-dropdown

🔽 A dead simple dropdown component for React

Home Page:http://fraserxu.github.io/react-dropdown/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clicking on dropdown doesn't make it focused

Vanuan opened this issue · comments

Why? Why did you add stopPropagation() and preventDefault() here?

https://github.com/fraserxu/react-dropdown/blob/747af52959bc4a4ee8a7d8c9779b498a07123bee/index.js#L52-L53

This prevents the div with tabindex to be focused.

Found a workaround:

const dropdown = useRef(null);
<Dropdown ref={dropdown} onFocus={() => dropdown.current.focus()} />

But why.

Hi @Vanuan I couldn't make your workaround work. Does it make the component focusable via keyboard as well? or only through click?

It seems the workaround works only for the older version of react-dropdown

+1, this how has this not been fixed lol. Stopped using the package due to this