fix(controller): reset shortcut target after navigation

This commit is contained in:
joshpatra committed 2026-07-23 00:08:38 -04:00
1 parent cb892a36a4
commit dad223d4ad
2 files changed
+48 -1

No files matched your search

+10 -1
View File
@@ -4557,7 +4557,16 @@ function attachMediaDetectionListeners(root) {
}
function scheduleNavigationRescan() {
window.vscLastObservedHref = location.href;
var nextHref = location.href;
if (window.vscLastObservedHref !== nextHref) {
// Pointer and controller interaction state belongs to the previous route.
// YouTube keeps hover-preview and Shorts players connected across SPA
// navigations, so retaining either target can send shortcuts to an
// off-screen/stale player even though the new watch controller works.
tc.lastPointerPosition = null;
tc.lastInteractedMedia = null;
}
window.vscLastObservedHref = nextHref;
clearTimeout(window.vscNavigationRescanTimer);
window.vscNavigationRescanTimer = setTimeout(function() {
initializeWhenReady(document, true);