mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
Merge pull request #605 from PR0M3TH3AN/codex/update-closeallmenus-and-related-callbacks
Fix focus restoration when closing video menus
This commit is contained in:
2 files changed
+11
-7
No files matched your search
@@ -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 });
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user