From 13e7980071ab11b07b5d473e43506c6cb4ab637e Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Mon, 12 Oct 2026 12:57:49 +0200 Subject: fix: keep the photo lightbox's close button on a phone screen The bar was 457 px wide and pushed the close button to 397..437 px, off a 360 px phone. Delete leaves the lightbox (it stays on the tile's menu: right-click, or press and hold), and below 768 px the bar drops the file name, the zoom label and 100%. Co-Authored-By: Claude Opus 5.5 --- packages/meshbay-hub/tests/test_layout_measured.py | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'packages/meshbay-hub/tests/test_layout_measured.py') diff --git a/packages/meshbay-hub/tests/test_layout_measured.py b/packages/meshbay-hub/tests/test_layout_measured.py index 298a754..96f035f 100644 --- a/packages/meshbay-hub/tests/test_layout_measured.py +++ b/packages/meshbay-hub/tests/test_layout_measured.py @@ -362,3 +362,54 @@ def test_the_name_leaves_the_trigger_on_mobile_only(full_nav, width): assert shown == (width > 768), ( f"at {width} px the name in the user menu is " f"{'shown' if shown else 'hidden'}") + + +# The photo lightbox's bar. With the file name, the zoom label, 100% and a +# delete button it was 457 px wide, and the close button sat at 397..437 px — +# off a 360 px phone, with no other way out of the lightbox on screen. The +# fixture is `Lightbox()`'s bar, cast button and copy-link included. +_ZOOM_ICON = '' +LIGHTBOX_BAR = textwrap.dedent(f""" +
+
+ IMG_20150510_205012.JPG +
+ + Ajusté + + + +
+ +
+ + +
+
+""") +LIGHTBOX_WIDTHS = [320, 360, 412, 768, 1024] + + +@pytest.fixture(scope="module") +def lightbox_bar(tmp_path_factory): + fragment = tmp_path_factory.mktemp("lightbox") / "fragment.html" + fragment.write_text(LIGHTBOX_BAR, encoding="utf-8") + proc = subprocess.run( + ["python3", str(HARNESS), ",".join(str(w) for w in LIGHTBOX_WIDTHS), + str(fragment), ".lightbox-close", ".video-title"], + capture_output=True, text=True, timeout=180) + assert proc.returncode == 0, f"probe failed: {proc.stdout}{proc.stderr}" + out = json.loads(proc.stdout) + assert "error" not in out, f"no measurement: {out}" + return out + + +@pytest.mark.parametrize("width", LIGHTBOX_WIDTHS) +def test_the_lightbox_close_button_is_on_screen(lightbox_bar, width): + close = lightbox_bar[str(width)]["boxes"][".lightbox-close"] + assert close["right"] <= width, ( + f"at {width} px the lightbox's close button ends at {close['right']} px") + + +def test_the_file_name_stays_in_the_desktop_lightbox(lightbox_bar): + assert lightbox_bar["1024"]["boxes"][".video-title"]["width"] > 200 -- cgit v1.2.3