BitBoxSwiss / bitbox-wallet-app

The BitBoxApp for desktop and mobile.
https://bitbox.swiss/app
Apache License 2.0
245 stars 82 forks source link

frontend: remove keydown blocking in spinner component #2764

Closed thisconnect closed 4 weeks ago

thisconnect commented 1 month ago

The Spinner component has some logic that aggressively suppresses keydown events, it prevents the default bubbling of the event and removes focus from the active element.

This was done to prevent the user from accidentally navigating or changing a form that was covered by the Spinner.

The logic was introduced to Spinner and WaitDialog in:

Listening to global document and preventing the event is a bit a hack and at some point this broke on macOS. It still works on Linux and is the reason for a regression. The bug is that users can not enter a device name during setup and the input element looses focus when typing.

Regression was introduced in a change that conditionally shows the Spinner in the Waiting view. As the setup wizard itself is now an overlay, the Spinner can be rendered below and is not visible but still suppresses global keydown event.

To prevent such issues this commit removes the logic in Spinner. This should be fine in cases where the Spinner does not cover any elements (account overview, buy info). Spinner is also used to cover iframes until onload event occurs, this should be ok as the spinner only appears quickly.

WaitDialog should not be rendered below an overlay, but also the keydown event suppression does not work on macOS. Keeping as is for now.

This commit only fixes the regression, but there are a few changes that could improve blocking the UI in the future:

thisconnect commented 4 weeks ago

rebased PTAL @benma @strmci