Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: keep phone media arrows clear of settings (#10690)

Adam Eivy424eacf9abd5
diff --git a/client/src/components/media/MediaLightbox.browser.test.js b/client/src/components/media/MediaLightbox.browser.test.js
index 9a8921178e..4c63565e87 100644
--- a/client/src/components/media/MediaLightbox.browser.test.js
+++ b/client/src/components/media/MediaLightbox.browser.test.js
@@ -220,6 +220,51 @@ describe.skipIf(!chrome)('MediaLightbox native video keyboard controls', () => {
await page.close();
}
}, 60000);
+
+ it.each([[360, 568], [360, 640], [390, 667], [360, 800]])('keeps phone navigation inside media and settings Close clickable at %dx%d', async (width, height) => {
+ const page = await browser.newPage({ viewport: { width, height } });
+ try {
+ await page.route('**/api/**', route => route.fulfill({ json: { providers: [], items: [] } }));
+ await page.goto(`${origin}lightbox-test`);
+ await page.locator('#gallery').click();
+ const media = page.getByRole('dialog').locator(':scope > div > div').first();
+ const assertInsideMedia = async locator => {
+ const box = await locator.boundingBox();
+ const surface = await media.boundingBox();
+ expect(box.width).toBeGreaterThanOrEqual(44);
+ expect(box.height).toBeGreaterThanOrEqual(44);
+ expect(box.x).toBeGreaterThanOrEqual(surface.x - 1);
+ expect(box.y).toBeGreaterThanOrEqual(surface.y - 1);
+ expect(box.x + box.width).toBeLessThanOrEqual(surface.x + surface.width + 1);
+ expect(box.y + box.height).toBeLessThanOrEqual(surface.y + surface.height + 1);
+ };
+ const clickAtCenter = async locator => {
+ const box = await locator.boundingBox();
+ const x = box.x + box.width / 2;
+ const y = box.y + box.height / 2;
+ expect(await page.evaluate(({ x, y, name }) => document.elementFromPoint(x, y)?.closest('button')?.getAttribute('aria-label') === name,
+ { x, y, name: await locator.getAttribute('aria-label') })).toBe(true);
+ await page.mouse.click(x, y);
+ };
+
+ const close = page.locator('aside header button[aria-label="Close"]');
+ await clickAtCenter(close);
+ await page.getByRole('dialog').waitFor({ state: 'detached' });
+
+ await page.locator('#gallery').click();
+ const next = page.getByRole('button', { name: 'Next media' });
+ await assertInsideMedia(next);
+ await clickAtCenter(next);
+ await page.getByRole('img', { name: 'Synthetic image 1', exact: true }).waitFor();
+ const previous = page.getByRole('button', { name: 'Previous media' });
+ await assertInsideMedia(previous);
+ await clickAtCenter(previous);
+ await page.getByRole('img', { name: 'Synthetic image 0', exact: true }).waitFor();
+ } finally {
+ await page.close();
+ }
+ }, 60000);
+
// This catches footer-induced body collapse using real CSS rectangles, not
// class names. All media and callbacks are synthetic and requests intercepted.
it.each(['classic-midnight', 'kestrel-neon'])('keeps settings and image/video actions reachable in %s', async theme => {
diff --git a/client/src/components/media/MediaLightbox.jsx b/client/src/components/media/MediaLightbox.jsx
index a523d13d91..13ecc4a227 100644
--- a/client/src/components/media/MediaLightbox.jsx
+++ b/client/src/components/media/MediaLightbox.jsx
@@ -300,9 +300,28 @@ export default function MediaLightbox({
const overlayPad = fullScreen ? 'p-0' : 'p-4';
const imgMax = fullScreen ? 'max-w-[100vw] max-h-dvh-cap' : 'max-w-full max-h-dvh-cap [--dvh-cap:92vh] [--dvh-cap-dynamic:92dvh] [--dvh-inset:2rem]';
// Anchor low in fullscreen so the chevrons land in the letterbox bar of a
- // landscape image instead of covering it. Non-fullscreen keeps them centered
- // — bottom-anchoring would bury them in the SettingsPane underneath.
+ // landscape image instead of covering it. On phones, render arrows inside
+ // the media surface; the settings pane is stacked below it and must never
+ // share their hit area. Wider layouts keep viewport-edge navigation.
const chevronPositionClass = fullScreen ? 'bottom-4' : 'top-1/2 -translate-y-1/2';
+ const renderNavigationButton = (direction, placement) => {
+ const previous = direction === 'previous';
+ const handler = previous ? onPrevious : onNext;
+ const label = previous ? 'Previous media' : 'Next media';
+ const position = previous ? 'left-3 md:left-5' : 'right-3 md:right-5';
+ return (
+ <button
+ key={`${direction}-${placement}`}
+ type="button"
+ onClick={(e) => { e.stopPropagation(); handler?.(); }}
+ className={`absolute ${position} ${placement === 'mobile' ? 'top-1/2 -translate-y-1/2 md:hidden' : placement === 'wide' ? `hidden md:block ${chevronPositionClass}` : 'bottom-4'} z-30 p-2.5 text-white/80 hover:text-white bg-black/40 hover:bg-black/60 backdrop-blur-sm focus:outline-none focus:ring-2 focus:ring-port-accent rounded-full`}
+ aria-label={label}
+ title={previous ? 'Previous' : 'Next'}
+ >
+ {previous ? <ChevronLeft className="w-6 h-6" /> : <ChevronRight className="w-6 h-6" />}
+ </button>
+ );
+ };
// Portal to <body>. The overlay is a hand-rolled `fixed inset-0` (this file
// opts out of <ui/Modal> and its `usePortal`, see the note at the top), and
@@ -328,28 +347,14 @@ export default function MediaLightbox({
// (button, input) and only fires if this div itself were ever focused.
onKeyDown={onActivateKeyDown(onClose)}
>
- {hasPrevious && (
- <button
- type="button"
- onClick={(e) => { e.stopPropagation(); onPrevious?.(); }}
- className={`absolute left-3 md:left-5 ${chevronPositionClass} z-30 p-2.5 text-white/80 hover:text-white bg-black/40 hover:bg-black/60 backdrop-blur-sm focus:outline-none focus:ring-2 focus:ring-port-accent rounded-full`}
- aria-label="Previous media"
- title="Previous"
- >
- <ChevronLeft className="w-6 h-6" />
- </button>
- )}
- {hasNext && (
- <button
- type="button"
- onClick={(e) => { e.stopPropagation(); onNext?.(); }}
- className={`absolute right-3 md:right-5 ${chevronPositionClass} z-30 p-2.5 text-white/80 hover:text-white bg-black/40 hover:bg-black/60 backdrop-blur-sm focus:outline-none focus:ring-2 focus:ring-port-accent rounded-full`}
- aria-label="Next media"
- title="Next"
- >
- <ChevronRight className="w-6 h-6" />
- </button>
- )}
+ {!fullScreen && <>
+ {hasPrevious && renderNavigationButton('previous', 'wide')}
+ {hasNext && renderNavigationButton('next', 'wide')}
+ </>}
+ {fullScreen && <>
+ {hasPrevious && renderNavigationButton('previous', 'fullscreen')}
+ {hasNext && renderNavigationButton('next', 'fullscreen')}
+ </>}
<div
className={cardClasses}
onClick={(e) => e.stopPropagation()}
@@ -370,6 +375,8 @@ export default function MediaLightbox({
// navigation while the browser is handling the gesture.
style={{ touchAction: 'manipulation' }}
>
+ {!fullScreen && hasPrevious && renderNavigationButton('previous', 'mobile')}
+ {!fullScreen && hasNext && renderNavigationButton('next', 'mobile')}
{/* Fail-safe close — the SettingsPane's X is hidden in fullscreen
and unreachable if iOS Safari mis-lays out the page. Keep it
before the media so native video controls sit inside the trap's