fix: Download choices open off the left edge of the screen on phones (#32179)

On a narrow phone screen, the Download choices in the chat header menu, in a chat's menu in the sidebar and in the note menu opened to the left of the menu, past the edge of the screen, with their labels cut off. When there is no room for them on either side of the menu, they now open over the menu, fully on screen. Where there is room beside the menu, they open as before.

Fixes #32015
This commit is contained in:
Classic298 2026-10-10 17:47:13 +02:00 • committed by GitHub
parent e86c82406d
commit f7727e24b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -76,7 +76,12 @@
contentEl.style.paddingLeft = `${sideOffset}px`;
} else {
// Open to the left: position flush with trigger, bridge gap with right padding
contentEl.style.right = `${window.innerWidth - rect.left}px`;
// Neither side fits on narrow screens: overlap the menu to stay on screen
const right = Math.min(
window.innerWidth - rect.left,
window.innerWidth - contentWidth - sideOffset - 16
);
contentEl.style.right = `${right}px`;
contentEl.style.left = 'auto';
contentEl.style.paddingRight = `${sideOffset}px`;
}