Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Restore clicks on the next/prev arrows

Manav Rathi5a3b72b1415b
diff --git a/web/apps/photos/src/styles/photoswipe.css b/web/apps/photos/src/styles/photoswipe.css
index fbbbae9e3e..6f55264b31 100644
--- a/web/apps/photos/src/styles/photoswipe.css
+++ b/web/apps/photos/src/styles/photoswipe.css
@@ -216,6 +216,20 @@
--media-font-family: "Inter Variable", sans-serif;
--media-control-background: transparent;
--media-control-hover-background: rgb(255 255 255 / 0.12);
+ /*
+ Prevent menus from occluding clicks on other controls when hidden.
+
+ [Note: Showing menus outside of media-controller]
+
+ This is all very hacky. None of the media controller examples currently
+ show menus work for our specific scenario (the controls detached from the
+ the media controller itself, and shown at the bottom of the screen). As
+ such, a lot of undocumented and arbitrary tweaks are needed. This is a
+ house of cards, and might fall when the media-chrome version is updated;
+ on the other hand, they might also add better support for our scenario, in
+ which case this should be possible straightforwardly.
+ */
+ --media-menu-hidden-max-height: 1px;
}
/*
@@ -279,7 +293,19 @@ media-settings-menu {
*/
--media-control-background: var(--mui-palette-fixed-dark-background-paper);
--media-menu-border: 10px solid #1b1b1b;
+ /* Regular, but since the rest of media controls use 400, it
+ appears heavier. */
--media-font-weight: 500;
- /* Bring it above the rest of our controls */
- /* z-index: 1; */
+ /*
+ Bring it above the rest of our controls.
+
+ See: [Note: Showing menus outside of media-controller]
+ */
+ z-index: 1;
+ /*
+ Undo the effects of --media-menu-hidden-max-height.
+
+ See: [Note: Showing menus outside of media-controller]
+ */
+ --media-menu-max-height: 1000px;
}
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 85c3ea4893..1f86be8476 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -447,20 +447,21 @@ export class FileViewerPhotoSwipe {
let mediaControlsContainerElement: HTMLElement | undefined;
/**
- * If a {@link mediaControllerID} is provided, then make the
- * media controls visible and link the media-control-bar to the given
- * controller. Otherwise hide the media controls.
+ * If a {@link mediaControllerID} is provided, then make the media
+ * controls visible and link the media-control-bars (and other
+ * containers that house controls) to the given controller. Otherwise
+ * hide the media controls.
*/
const updateMediaControls = (mediaControllerID: string | undefined) => {
- const controlBars =
+ const controls =
mediaControlsContainerElement?.querySelectorAll(
"media-control-bar, media-playback-rate-menu",
) ?? [];
- for (const bar of controlBars) {
+ for (const control of controls) {
if (mediaControllerID) {
- bar.setAttribute("mediacontroller", mediaControllerID);
+ control.setAttribute("mediacontroller", mediaControllerID);
} else {
- bar.removeAttribute("mediacontroller");
+ control.removeAttribute("mediacontroller");
}
}
};
@@ -1169,6 +1170,8 @@ const hlsVideoHTML = (url: string, mediaControllerID: string) => `
*
* - When PiP is active and the video moves out, the browser displays some
* indicator (browser specific) in the in-page video element.
+ *
+ * - The media-cast-button currently doesn't work with the `hls-video` player.
*/
const hlsVideoControlsHTML = () => `
<div>
@@ -1180,8 +1183,6 @@ const hlsVideoControlsHTML = () => `
</media-playback-rate-menu>
</media-settings-menu-item>
</media-settings-menu>
- <media-playback-rate-menu id="m2" hidden anchor="b2"></media-playback-rate-menu>
-
<media-control-bar>
<media-loading-indicator noautohide></media-loading-indicator>
</media-control-bar>