Fullscreen composer keyboard shortcut works only once

It seems i cannot go to fullscreen by pressing shift+f11 but only exit the fullscreen. (i have to press the fullscreen button first).

It’s also weird that when the editor is in fullscreen if i keep shift pressed then quickly keep pressing f11 multiple times, the editor goes full <-> not full as long as the previous animation was not finished.

Happens here on meta, on chrome.

2 Likes

Hmmm I can even get SHIFT F11 to work here either to open or close fullscreen.

Using this keyboard on Windows, tested on Chrome and Firefox.

@Johani can you have a look, I wonder if we should pick a different shortcut here.

3 Likes

The reason this happens is because the composer title steals focus when the composer is opened.

https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/templates/composer.hbs#L62

So when you use the shortcut, you’re using it while the input is focused and that’s why it doesn’t work. You’d need to click somewhere outside to remove the focus from the input. Although slightly less obvious, the composer body text area - if focused - will also interfere with the shortcut.

When you enter full screen mode the title input is removed, when you exit, it gets re-inserted and steals focus again. This is why this occurs

Mousetrap has a way to handle this, to add a mousetrap class to the markup of those elements, the shortcut would then fire even if the inputs are focused, but so will all the other keyboard shortcuts and it creates a lot more problems than it solves.

Sure, just let me know what works for you.

4 Likes

This was fixed by @pmusaraj :heart: a while back and I forgot to update here.

https://github.com/discourse/discourse/pull/6907/files

The shortcut should now work regardless of whether or not the input / textarea are focused.

Thanks for reporting the issue @TheBestPessimist :+1:

6 Likes