Skip to content

armgit / ente

Public Imported from GitHub
0

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

Hide more menu button in embed viewer when it would be empty

Manav Rathi34a9b5827355
diff --git a/web/packages/gallery/components/viewer/photoswipe.ts b/web/packages/gallery/components/viewer/photoswipe.ts
index 86274f9201..2e09b04ea0 100644
--- a/web/packages/gallery/components/viewer/photoswipe.ts
+++ b/web/packages/gallery/components/viewer/photoswipe.ts
@@ -1226,23 +1226,31 @@ export class FileViewerPhotoSwipe {
onClick: handleViewInfo,
});
- ui.registerElement({
- name: "more",
- title: t("more"),
- order: 16,
- isButton: true,
- html: createPSRegisterElementIconHTML("more"),
- onInit: (buttonElement) => {
- buttonElement.setAttribute("id", moreButtonID);
- buttonElement.setAttribute("aria-haspopup", "true");
- },
- onClick: (_, buttonElement) => {
- // See also: `resetMoreMenuButtonOnMenuClose`.
- buttonElement.setAttribute("aria-controls", moreMenuID);
- buttonElement.setAttribute("aria-expanded", "true");
- onMore(buttonElement);
- },
- });
+ // Only show the more button if there are meaningful items to display.
+ // When fullscreen is shown in the toolbar (showFullscreenButton=true)
+ // and we're in a context without user actions (no delete, archive, etc),
+ // hide the more menu since it would only contain fullscreen and shortcuts.
+ const shouldShowMoreButton = !showFullscreenButton || haveUser;
+
+ if (shouldShowMoreButton) {
+ ui.registerElement({
+ name: "more",
+ title: t("more"),
+ order: 16,
+ isButton: true,
+ html: createPSRegisterElementIconHTML("more"),
+ onInit: (buttonElement) => {
+ buttonElement.setAttribute("id", moreButtonID);
+ buttonElement.setAttribute("aria-haspopup", "true");
+ },
+ onClick: (_, buttonElement) => {
+ // See also: `resetMoreMenuButtonOnMenuClose`.
+ buttonElement.setAttribute("aria-controls", moreMenuID);
+ buttonElement.setAttribute("aria-expanded", "true");
+ onMore(buttonElement);
+ },
+ });
+ }
// Add fullscreen button as a primary action for embed app
if (showFullscreenButton) {