Work around chromium bug where focus gets stolen from shadow DOM

Fixes #4255