mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 20:32:27 +00:00
Toggle popovers when re-clicking triggers
This commit is contained in:
1 parent
4bba633332
commit
4618b8c5ca
2 files changed
+31
-3
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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 });
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user