Not a bug Insert > Code won't always set the focus correctly

thedude

Well-known member
Affected version
2.0 RC3
To demonstrate easily, copy some text into the clipboard.

1. In the reply box below, click the Insert > Code icon (the popup input box should have focus initially)

2. Click outside of the popup box so it vanishes (doesn't matter where)

3. Click Insert > Code again and hit Ctrl-V (or Command-V) and notice the code box didn't have focus this time, causing the pasting to go into the main reply box underneath the popup

Running Chrome 62.0.3202.97
 
This is actually sort of expected. We set the code editor to be auto focused on its first initialisation and we cache the overlay. If we didn't cache the overlay then it'd be really annoying if you accidentally closed the overlay and lost all of the code you had been writing.

You're effectively losing focus by closing the overlay. So really what you're seeing is just how text editors should work.

I'm reticent to do any magic sort of auto focus stuff here (outside of the default behaviour) as it's generally flaky if it's programmatically done, especially when it comes to things like touch devices. Having the keyboard unexpectedly pop up can be annoying.
 
Back
Top Bottom