Closing dropdown does not set focus back to dropdown trigger element
Discovered while working on https://github.com/twbs/bootstrap/issues/28751
To reproduce:
- go to /components/dropdowns/ in the v5 docs https://twbs-bootstrap.netlify.com/docs/4.3/components/dropdowns/
- open a dropdown
- use cursor/arrow keys or TAB to get focus into the menu
- press ESC
Expected:
- dropdown is closed and focus is reset to the dropdown trigger button
Actual:
- dropdown is closed, but focus is lost (querying document.activeElement shows focus went back to body, and the dropdown trigger doesn't have any visible focus outline/indication)
This is a regression from v4, where this worked correctly (see https://getbootstrap.com/docs/4.3/components/dropdowns/)