obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording
https://obsproject.com
GNU General Public License v2.0
60.24k stars 7.98k forks source link

When a web interface is shown, and I have to alt-tab out, focus is not restored when alt-tabbing back in. #3119

Open MarcoZehe opened 4 years ago

MarcoZehe commented 4 years ago

Platform

Operating system and version: Windows 10 May 2020 update OBS Studio version: 25.0.8

Expected Behavior

When alt-tabbing back into OBS studio, and a web page was active, I expect keyboard focus to return to the entry field I was on. keyboard focus is on the window that brought up the web interface.

Current Behavior

When alt-tabbing back into OBS Studio, keyboard focus is on the window that brought up the web interface.

Steps to Reproduce

  1. Open OBS Studio and configure for streaming. Choose Twitch and select to authorize the account.
  2. The Twitch login comes up. Alt-tab out to copy your password from a password manager like 1Password.
  3. Alt-tab back in.
  4. Keyboard focus is reported to be on the dialog that opened for authorization.

Additional information

I am blind and use the NVDA screen reader. Once I alt-tab out of OBS Studio, and back in, NVDA no longer finds the web interface or many other controls inside such windows or dialogs.

This also happens after configuration finishes and one is supposed to fill in some details about the stream, like the title or message to tweet etc. If I alt-tab out, then back in, there is no way I can get that window back into focus and fill it out.

MarcoZehe commented 4 years ago

OK, some more information. Using the commercial JAWS screen reader, I am at least able to find the window on the screen, and when clicking it or double-tapping on the touch screen, it comes back into focus. With NVDA, I have so far not been able to find that window again.

It also seems to be a dockable window, which I can close with Alt+F4. It's called "Twitch stream information", and it definitely doesn't like being alt-tabbed out of, at least what screen readers are concerned. Hope this information helps identify the problem further.

WizardCM commented 4 years ago

I have tried to fight this in like 30 different ways. The same issue exists for both OAuth dialogs like Twitch, and custom browser docks.

It'll also cause hotkeys to behave unpredictably when "Hotkey Focus Behaviour" is set to anything other than "Never disable hotkeys" because if you focus a browser panel then unfocus OBS, Qt is never told that OBS is no longer focused.

In my own research and testing, there's a FocusHandler exposed by CEF, but it does none of what we need it to do for this to work. Focusing the parent QWidget doesn't work either.

There must be some way somewhere to fix it, but I can't figure out if it has to be within OBS or CEF.

OldBaldGeek commented 3 years ago

Should I file a separate defect for the "unpredictable hotkey" issue described by Wizard CM? It may have the same cause as "fails to restore focus", but my symptom is "why is my typing in Notepad++ triggering OBS actions?" I only found WizardCM's explanation because I read every hotkey-related issue.

PatTheMav commented 2 years ago

I've just tried to reproduce this in our newest release (OBS 28.0.3):

@tytan652 or @kkartaltepe can either of you check this on Linux?

kkartaltepe commented 2 years ago

im not sure about native X11 gnome, but at least for me this does not appear to happen on linux. Shifting window focus in i3 does not lose input on the twitch account name field. Shifting window focus in gnome-shell with xwayland does lose focus if the mouse is not within the bounds of the window, but bringing the mouse back into the window it restores input focus (i presume this would work like i3 if i were not using xwayland).

PatTheMav commented 2 years ago

So sounds like this is a Windows-only issue.

Fenrirthviti commented 3 weeks ago

Confirming that this is still an issue after the latest update to CEF. I don't have a good grasp for expected behavior as I've tested in a few other applications and there doesn't appear to be any consistency in how it's handled.

It seems the majority of the issue is that when tabbing back to OBS, it has the pop-up selected, but keys are not sent to the CEF content inside. You'd have to click inside the window first to shift focus to the CEF content, at which point keyboard navigation works properly again (even if Username in the example provided is not selected, you can still tab-navigate to select it again).