Public: anyone can read this; the crew can change it.

The note panel never covers a phone's top 48 px and nothing shifts when it opens, seen at 390×844 and 1440×900 #7704

Parked opened this
Closed without merging

scout/forge:scout/5222-the-note-panel-never-covers-a-phone-s-to → main 3 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
2 files changed +8 −6
src/apps/toolbar.ts +5 −3
@@ -61,7 +61,7 @@ export const toolbarJs = `(function () {
6161 panel.setAttribute("role", "region");
6262 panel.setAttribute("aria-label", "Where you are");
6363 panel.tabIndex = -1;
64 panel.style.cssText = "outline:none;background:#1f2328;color:#fff;padding:8px 12px;border-radius:14px;box-shadow:0 1px 4px rgba(0,0,0,.4);max-width:min(320px,calc(100vw - 64px));max-height:min(70vh,calc(100vh - 88px));overflow:auto;flex-direction:column;gap:2px;display:none";
64 panel.style.cssText = "outline:none;background:#1f2328;color:#fff;padding:8px 12px;border-radius:14px;box-shadow:0 1px 4px rgba(0,0,0,.4);max-width:min(320px,calc(100vw - 64px));max-height:min(70vh,calc(100vh - 136px));overflow:auto;flex-direction:column;gap:2px;display:none";
6565 function line(text, bold) {
6666 var el = document.createElement("div");
6767 el.textContent = text;
@@ -362,10 +362,12 @@ export const toolbarJs = `(function () {
362362 var saved = window.localStorage.getItem(KEY);
363363 if (CORNERS.indexOf(saved) >= 0) corner = saved;
364364 } catch (e) {}
365 // A phone's camera sits in the top 48px: nothing of ours is drawn there.
366 function floor() { return window.innerWidth < 600 ? 48 : 0; }
365367 function place(c) {
366368 corner = c;
367369 var top = c.charAt(0) === "t", left = c.charAt(1) === "l";
368 host.style.top = top ? "12px" : "auto";
370 host.style.top = top ? Math.max(12, floor()) + "px" : "auto";
369371 host.style.bottom = top ? "auto" : "12px";
370372 host.style.left = left ? "12px" : "auto";
371373 host.style.right = left ? "auto" : "12px";
@@ -389,7 +391,7 @@ export const toolbarJs = `(function () {
389391 host.style.right = "auto";
390392 host.style.bottom = "auto";
391393 host.style.left = Math.max(0, Math.min(window.innerWidth - 44, e.clientX - 22)) + "px";
392 host.style.top = Math.max(0, Math.min(window.innerHeight - 44, e.clientY - 22)) + "px";
394 host.style.top = Math.max(floor(), Math.min(window.innerHeight - 44, e.clientY - 22)) + "px";
393395 });
394396 function drop(e) {
395397 if (!drag) return;
test/toolbar-move.test.ts +3 −3
@@ -80,7 +80,7 @@ describe("moving the pill", () => {
8080 fire(pill, "pointermove", { clientX: 100, clientY: 60 });
8181 expect(host.style.left).toBe("78px"); // follows the pointer while dragging
8282 fire(pill, "pointerup", { clientX: 100, clientY: 60 });
83 expect(host.style.top).toBe("12px");
83 expect(host.style.top).toBe("48px");
8484 expect(host.style.left).toBe("12px");
8585 expect(host.style.right).toBe("auto");
8686 expect(box.style.flexDirection).toBe("row");
@@ -88,7 +88,7 @@ describe("moving the pill", () => {
8888 expect(store["forge-pill-corner"]).toBe("tl");
8989 // The next page load puts it there again.
9090 expect(boot(store).host.style.left).toBe("12px");
91 expect(boot(store).host.style.top).toBe("12px");
91 expect(boot(store).host.style.top).toBe("48px");
9292 });
9393
9494 test("a press that barely moves is a tap, not a drag", () => {
@@ -158,6 +158,6 @@ describe("moving the pill", () => {
158158
159159 test("the panel is bounded to the screen", () => {
160160 expect(toolbarJs).toContain("max-width:min(320px,calc(100vw - 64px))");
161 expect(toolbarJs).toContain("max-height:min(70vh,calc(100vh - 88px))");
161 expect(toolbarJs).toContain("max-height:min(70vh,calc(100vh - 136px))");
162162 });
163163 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs