Toggle card popovers when re-clicked

This commit is contained in:
thePR0M3TH3AN committed 2025-10-16 22:56:30 -04:00
1 parent 62d91468a1
commit 4bba633332
3 files changed
+56 -14

No files matched your search

+21 -3
View File
@@ -1421,7 +1421,7 @@ export class VideoCard {
event.stopPropagation();
if (this.onRequestCloseAllMenus) {
this.onRequestCloseAllMenus(this);
this.onRequestCloseAllMenus({ restoreFocus: false });
} else {
this.closeSettingsMenu({ restoreFocus: false });
}
@@ -1446,10 +1446,28 @@ export class VideoCard {
event.preventDefault();
event.stopPropagation();
const trigger = this.moreMenuButton;
const isExpanded =
typeof trigger?.getAttribute === "function" &&
trigger.getAttribute("aria-expanded") === "true";
if (this.onRequestCloseAllMenus) {
this.onRequestCloseAllMenus(this);
const options = { restoreFocus: false };
if (isExpanded) {
options.skipCard = this;
options.skipTrigger = trigger;
}
this.onRequestCloseAllMenus(options);
}
if (isExpanded) {
this.closeSettingsMenu({ restoreFocus: false });
this.closeMoreMenu({ restoreFocus: false });
return;
}
this.closeSettingsMenu({ restoreFocus: false });
if (this.callbacks.onRequestMoreMenu) {
const actionForwarder = this.callbacks.onMoreAction
? ({ action, dataset, event: actionEvent }) => {
@@ -1468,7 +1486,7 @@ export class VideoCard {
this.callbacks.onRequestMoreMenu({
event,
trigger: this.moreMenuButton,
trigger,
video: this.video,
card: this,
pointerInfo: this.pointerInfo,