URL: https://www.youtube.com/watch?v=hfRP2ICJjgE
Browser / Version: Firefox 121.0
Operating System: Windows 10
Tested Another Browser: Yes Edge
Problem type: Something else
Description: Spacebar to play/pause video on YouTube doesn't work after ctrl+tab or alt+tab
Steps to Reproduce:
If you start playing a video on YouTube, you're supposed to be able to pause/play it with the Spacebar. This has worked for a long time, but an issue has recently appeared. If you press Ctrl+Tab to switch tabs, then switch back, Spacebar will stop working on YouTube until you click on the video. The same is true if you press Alt+Tab, at least on Windows.
I tested this on Edge too, and it turns out that Ctrl+Tab doesn't cause the same issue on Edge, but Alt+Tab does. I think it might have to do with whether the browser dispatches the Tab keyboard event to the YouTube window or not. Since that might be different between Firefox's and Edge's Ctrl+Tab handlers, whereas Alt+Tab is handled by the OS.
You'd think maybe YouTube has some event listener that is hearing about the Tab keypress and moving focus. But if you check document.activeElement
before and after switching tabs, it doesn't change. It remains on #movie_player
, yet pressing the Spacebar stops working. Whereas if you simply press Tab, focus does move.
Anyway, at this point the only way to get the Spacebar hotkey working again is to click the video, which is a pretty big hit to accessibility and usability if you're trying to just use keyboard. I have YouTube videos playing in the background all the time, so I'm constantly switching back and forth between tabs, playing and pausing videos. So not being able to pause YouTube videos via keyboard has been quite a papercut.
This is probably largely a site issue, but given that the problem seems so much worse on Firefox (due to it affecting Ctrl+Tab, not just Alt+Tab), it may deserve an intervention, assuming it's a small fix.
Browser Configuration
- gfx.webrender.all: false
- buildID: 20231117214639
- channel: nightly
- hasTouchScreen: false
- mixed active content blocked: false
- mixed passive content blocked: false
- tracking content blocked: false
View console log messages
Edit: I should also mention, I reported this from my usual profile, so there are addons affecting YouTube that you can see in the log. But I also tested this on a new Firefox profile, on a local build, and in Edge (where I have no addons, since I only use Edge for testing). So I don't think this is attributable to any settings or extensions in my profile.
From webcompat.com with ❤️
URL: https://www.youtube.com/watch?v=hfRP2ICJjgE
Browser / Version: Firefox 121.0
Operating System: Windows 10
Tested Another Browser: Yes Edge
Problem type: Something else
Description: Spacebar to play/pause video on YouTube doesn't work after ctrl+tab or alt+tab
Steps to Reproduce:
If you start playing a video on YouTube, you're supposed to be able to pause/play it with the Spacebar. This has worked for a long time, but an issue has recently appeared. If you press Ctrl+Tab to switch tabs, then switch back, Spacebar will stop working on YouTube until you click on the video. The same is true if you press Alt+Tab, at least on Windows.
I tested this on Edge too, and it turns out that Ctrl+Tab doesn't cause the same issue on Edge, but Alt+Tab does. I think it might have to do with whether the browser dispatches the Tab keyboard event to the YouTube window or not. Since that might be different between Firefox's and Edge's Ctrl+Tab handlers, whereas Alt+Tab is handled by the OS.
You'd think maybe YouTube has some event listener that is hearing about the Tab keypress and moving focus. But if you check
document.activeElement
before and after switching tabs, it doesn't change. It remains on#movie_player
, yet pressing the Spacebar stops working. Whereas if you simply press Tab, focus does move.Anyway, at this point the only way to get the Spacebar hotkey working again is to click the video, which is a pretty big hit to accessibility and usability if you're trying to just use keyboard. I have YouTube videos playing in the background all the time, so I'm constantly switching back and forth between tabs, playing and pausing videos. So not being able to pause YouTube videos via keyboard has been quite a papercut.
This is probably largely a site issue, but given that the problem seems so much worse on Firefox (due to it affecting Ctrl+Tab, not just Alt+Tab), it may deserve an intervention, assuming it's a small fix.
Browser Configuration
View console log messages
Edit: I should also mention, I reported this from my usual profile, so there are addons affecting YouTube that you can see in the log. But I also tested this on a new Firefox profile, on a local build, and in Edge (where I have no addons, since I only use Edge for testing). So I don't think this is attributable to any settings or extensions in my profile.
From webcompat.com with ❤️