ItsJonQ / g2

✨ An experimental reimagining of WordPress components
http://g2-components.com/
MIT License
105 stars 12 forks source link

SelectDropdown: Focus "select" button on select action #209

Closed ItsJonQ closed 3 years ago

ItsJonQ commented 3 years ago

This update ensures that the "select" (button) is focused after a selection action is made (either with mouse events or keyboard events).

The solution involved creating an internal ref for the button element, and (force) focusing that element within the close callback.

Screen Capture on 2021-01-04 at 17-30-37

GIF above shows the Select element being focused (highlighted) after selecting an item.

Resolves https://github.com/ItsJonQ/g2/issues/208

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/itsjonq/g2/obyn3xwz6
✅ Preview: https://g2-git-fix-select-dropdown-focus-on-select.itsjonq.vercel.app