Fix: Enable video modal share button when source is available

The share button in the video modal was not being enabled correctly because `updateSourceAvailability` returned early if `sourceToggleContainer` was missing, skipping the `setShareEnabled` call.

This change ensures `setShareEnabled` is called based on `hasUrl` or `hasMagnet` before checking for `sourceToggleContainer`.

Added a regression test `tests/e2e/video-modal-share-bug.spec.ts`.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-23 04:51:14 +00:00
1 parent ba69eb6163
commit afa231da3e
2 files changed
+73 -4

No files matched your search

+6 -4
View File
@@ -2797,10 +2797,6 @@ export class VideoModal {
}
updateSourceAvailability(video) {
if (!this.sourceToggleContainer) {
return;
}
const hasUrl = Boolean(
typeof video?.url === "string" && video.url.trim()
);
@@ -2809,6 +2805,12 @@ export class VideoModal {
video?.torrentSupported
);
this.setShareEnabled(hasUrl || hasMagnet);
if (!this.sourceToggleContainer) {
return;
}
if (hasUrl || hasMagnet) {
this.sourceToggleContainer.removeAttribute("hidden");
this.sourceToggleContainer.classList.remove("hidden");