From b3d4220153b31cfb72206e6c3a665ee99d36c396 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Thu, 16 Oct 2025 18:16:55 -0400 Subject: [PATCH] Preserve focus opt-out when closing video menus --- js/ui/moreMenuController.js | 8 +++++--- js/ui/views/VideoListView.js | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/js/ui/moreMenuController.js b/js/ui/moreMenuController.js index 5c1c35e0..2f0cb0a4 100644 --- a/js/ui/moreMenuController.js +++ b/js/ui/moreMenuController.js @@ -424,13 +424,15 @@ export default class MoreMenuController { closeAllMoreMenus(options = {}) { const skipView = options?.skipView === true; + const restoreFocus = options?.restoreFocus !== false; if (!skipView && this.videoListView && typeof this.videoListView.closeAllMenus === "function") { - this.videoListView.closeAllMenus({ skipController: true }); + this.videoListView.closeAllMenus({ + skipController: true, + restoreFocus, + }); } - const restoreFocus = options?.restoreFocus !== false; - this.popoversByTrigger.forEach((entry) => { if (entry?.popover && typeof entry.popover.close === "function") { entry.popover.close({ restoreFocus }); diff --git a/js/ui/views/VideoListView.js b/js/ui/views/VideoListView.js index d3a8b07b..413d1686 100644 --- a/js/ui/views/VideoListView.js +++ b/js/ui/views/VideoListView.js @@ -441,7 +441,7 @@ export class VideoListView { }, ensureGlobalMoreMenuHandlers: () => this.utils.ensureGlobalMoreMenuHandlers(), - onRequestCloseAllMenus: () => this.closeAllMenus(), + onRequestCloseAllMenus: () => this.closeAllMenus({ restoreFocus: false }), formatters: { formatTimeAgo: this.formatters.formatTimeAgo, }, @@ -1032,16 +1032,18 @@ export class VideoListView { } closeAllMenus(options = {}) { + const restoreFocus = options?.restoreFocus !== false; + if (Array.isArray(this.videoCardInstances) && this.videoCardInstances.length) { this.videoCardInstances.forEach((card) => { if (!card) { return; } if (typeof card.closeMoreMenu === "function") { - card.closeMoreMenu(); + card.closeMoreMenu({ restoreFocus }); } if (typeof card.closeSettingsMenu === "function") { - card.closeSettingsMenu(); + card.closeSettingsMenu({ restoreFocus }); } }); } @@ -1051,7 +1053,7 @@ export class VideoListView { } if (typeof this.utils.closeAllMenus === "function") { - this.utils.closeAllMenus({ skipView: true }); + this.utils.closeAllMenus({ skipView: true, restoreFocus }); } }