Toggle popovers when re-clicking triggers

This commit is contained in:
thePR0M3TH3AN committed 2025-10-16 23:05:16 -04:00
1 parent 4bba633332
commit 4618b8c5ca
2 files changed
+31 -3

No files matched your search

+22 -3
View File
@@ -1420,16 +1420,35 @@ export class VideoCard {
event.preventDefault();
event.stopPropagation();
const trigger = this.settingsButton;
const isExpanded =
typeof trigger?.getAttribute === "function" &&
trigger.getAttribute("aria-expanded") === "true";
if (this.onRequestCloseAllMenus) {
this.onRequestCloseAllMenus({ restoreFocus: false });
} else {
const options = { restoreFocus: false };
if (isExpanded) {
options.skipCard = this;
options.skipTrigger = trigger;
}
this.onRequestCloseAllMenus(options);
} else if (!isExpanded) {
this.closeMoreMenu({ restoreFocus: false });
this.closeSettingsMenu({ restoreFocus: false });
}
if (isExpanded) {
this.closeMoreMenu({ restoreFocus: false });
this.closeSettingsMenu({ restoreFocus: false });
return;
}
this.closeMoreMenu({ restoreFocus: false });
if (this.callbacks.onRequestSettingsMenu) {
const detail = {
event,
trigger: this.settingsButton,
trigger,
video: this.video,
card: this,
index: this.index,
+9
View File
@@ -411,6 +411,15 @@ export class VideoModal {
if (this.modalZapBtn?.disabled) {
return;
}
const isExpanded =
this.modalZapBtn.getAttribute("aria-expanded") === "true";
if (isExpanded) {
this.closeZapDialog();
return;
}
this.openZapDialog();
this.dispatch("zap:open", { video: this.activeVideo });
});