palantir / blueprint

A React-based UI toolkit for the web
https://blueprintjs.com/
Apache License 2.0
20.65k stars 2.17k forks source link

Omnibar does not return focus when opened and closed for the second time #6873

Open evansjohnson opened 3 months ago

evansjohnson commented 3 months ago

Steps to reproduce

https://blueprintjs.com/docs/#select/omnibar

Actual behavior

From quick debugging, it looks like the dialog is trying to return focus to the input rendered in the omnibar dialog when closing the second time. This is due to thinking that the input is the "last focused element" the second time it opens.

Expected behavior

Omnibar should return focus since it does not override the Dialog's default shouldReturnFocusOnClose={true}. This is likely actually a Dialog issue but I did not attempt to reproduce outside of Omnibar yet.

Possible solution

Make sure the input that is rendered in the Dialog is not considered the last focused element before the Dialog opens