FIX: attempts to make autofocus more resilient in modals (PR #10680)

The current situation could cause a transition on the button to end after/during modal has shown and causing the button to get focus again. Browsers would then refuse to switch focus.

This is a kinda convulted solution, but it’s a general purpose solution which doesn’t involve changing anything in plugins/themes or core templates.

GitHub

This pull request has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/hyperlink-window-focus-does-not-get-to-the-hyperlink-textbox/164295/3