Make the phone work: touch reordering, reachable menus, and nothing lost offline

Four things that were built for a mouse on a desk and quietly did nothing
useful on a phone. The last one is the serious one.

**A note made offline lost everything written into it.** Its create
reached the server, the server named it something else, and every edit
still queued behind it went on addressing the name only that device ever
knew — 404, five retries, thrown away. The note arrived empty and
untitled, with nothing to say that anything had been lost. The database
was repointed at the new id all along; the queue was not. It is now, by
replacing the id across the whole queued payload rather than in a list of
named fields, because a list of fields is a list to forget to add to. The
same held for a notebook made offline and everything filed into it.

**The order of notes could not be changed on a phone**, because the list
went through the HTML5 drag API, which mobile browsers never fire from
touch. Pointer events instead, which mouse, pen and finger all produce. A
mouse still drags a row from anywhere; a finger drags from a grip,
because pressing the row has to go on scrolling and holding it has to go
on opening the menu. The row under the finger is found with
elementFromPoint — a finger raises no pointerover on anything it did not
press.

**"Move to..." opened off the side of the screen**, and could not be
opened at all without a hover. It is a tap now, unfolding in place where
there is no room beside the menu and flipping sides where there is. The
menu itself is placed by measuring rather than by assuming it is 220px
wide, its rows are tall enough to hit with a thumb, and Escape closes it.

**Installing said nothing when it could not be done.** The entry appeared
only when the browser had offered a prompt, so where installing was
impossible there was no button and no reason. It is always there now and
names the cause — most usefully that a browser will only install a site
served over HTTPS, which is also why the service worker would not have
registered, so one cause was showing up as two mysteries.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
marcandClaude Opus 5 committed 2026-08-12 01:16:41 +02:00
1 parent 6eecf57247
commit 608da16ac2
12 files changed
+743 -147

No files matched your search

+48
View File
@@ -131,6 +131,38 @@ try {
const status = await p.locator("body").innerText();
check(/offline|Pending|Wartet|Änderungen/i.test(status), "the app says it is offline rather than pretending");
/* ── the rest of what a note is, with no connection ──
* Reading and editing were covered. Making a note and drawing on one were
* not, and those are half of what the app is for on a phone — which is
* exactly where the connection is missing. */
const beforeNew = (await p.locator("[data-note-row]").count());
await createNote(p);
await p.waitForTimeout(1200);
await setTitle(p, "Offline entstanden");
await typeInEditor(p, "Ohne Netz geschrieben.");
await p.waitForTimeout(1500);
check(
(await p.locator("[data-note-row]").count()) > beforeNew,
"a note can be made with no connection",
`${beforeNew} → ${await p.locator("[data-note-row]").count()}`
);
await p.locator("button").filter({ hasText: "Draw" }).first().click();
await p.waitForTimeout(1200);
const canvas = await p.locator('canvas[data-draw-page="1"]').boundingBox();
await p.mouse.move(canvas.x + canvas.width * 0.3, canvas.y + canvas.height * 0.3);
await p.mouse.down();
await p.mouse.move(canvas.x + canvas.width * 0.7, canvas.y + canvas.height * 0.45, { steps: 12 });
await p.mouse.up();
await p.waitForTimeout(2500);
const inkOffline = await p.locator('canvas[data-draw-page="1"]').evaluate((c) => {
const d = c.getContext("2d").getImageData(0, 0, c.width, c.height).data;
let n = 0;
for (let i = 3; i < d.length; i += 4) if (d[i] > 40) n++;
return n;
});
check(inkOffline > 100, "and drawn on, with no connection", `${inkOffline} inked pixels`);
/* ── back on ── */
await context.setOffline(false);
await p.waitForTimeout(1000);
@@ -145,6 +177,22 @@ try {
"and the edit made offline reaches the server once there is a connection",
String(stored.body.content).slice(0, 80)
);
const made = server.find((n) => n.title === "Offline entstanden");
check(!!made, "the note made offline reaches the server too", made ? made.id : "not there");
if (made) {
const madeBody = await api(p, "GET", `/notes/${made.id}`);
check(
String(madeBody.body.content).includes("Ohne Netz"),
"with what was written in it",
String(madeBody.body.content).slice(0, 80)
);
check(
(madeBody.body.drawingStrokes?.strokes?.length ?? 0) > 0,
"and with the drawing that was made on it",
JSON.stringify(Object.keys(madeBody.body.drawingStrokes || {}))
);
}
} catch (e) {
check(false, "suite ran to the end", e.message);
} finally {