arrow-down arrow at-sign bug check checkbox-checked checkbox-unchecked svg-checkmark chevron-right chevrons-right circle-down circle-left circle-right circle-up cloud2 svg-cross2 download download external-link filter github hash home leaf leaf left link-2 log-in log-out mail menu message-square minus plus radio-checked radio-checked2 radio-unchecked search settings spinner8 target twitter up upload-2 user users warning x zap
  • Home
  • Report a bug
  • Contribute
  • All issues
  • Login

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 ❤️

Please login to edit issues.

View issue on Github

Shortcut: Press l on your keyboard to open the label editor. Shortcut: Press g on your keyboard to be taken to the GitHub view of this page.
Closed: Duplicate
#130750

www.youtube.com - Spacebar to play/pause video on YouTube doesn't work after ctrl+tab or alt

Opened: 2023-12-06
Reporter: aminomancer
Comments: 1
  • Home
  • List of issues
  • About
  • Contribute
  • Contact
  • Privacy Policy
  • Terms of Service
  • Code of Conduct