From 8d0ebdd4bc12732301d7fb5bc43291bd21e3e0e3 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Mon, 24 Aug 2026 13:43:06 +0000 Subject: [PATCH] Fix the heatmap caption needing several taps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A tap fires the emulated mouseenter and then the click on the same block, and the click handler was a toggle: the first of the pair selected the block, the second cleared it, so one tap left the caption exactly where it started. It only appeared on a later tap that arrived without a fresh mouseenter, which is what made it look like taps were being missed. The click now selects rather than toggles, so running both handlers for one tap is a no-op — the same idempotent shape the weight chart's hit targets already use. Tap-again-to-clear goes with it: telling a hover-set selection apart from a click-set one is more machinery than the affordance is worth, and the caption keeping its last block matches the weight chart's caption. The changelog entry that promised clearing is corrected in place, since the behaviour it describes never worked. --- src/app.js | 10 +++++++--- src/changelog.json | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app.js b/src/app.js index 6c97a35..a496730 100644 --- a/src/app.js +++ b/src/app.js @@ -1557,8 +1557,8 @@ svg.innerHTML = parts.concat(hits).join(""); // tooltips only ever show on a pointer, which left phones with no - // way to read a block's count. Tap/hover names the block under the chart; - // tapping the focused block again clears it. + // way to read a block's count. Tapping (or hovering) a block names it in + // the caption under the chart. const cells = svg.querySelectorAll(".hm-cell[data-cell]"); const focusCell = (key) => { hourCellSel = details[key] ? key : null; @@ -1567,7 +1567,11 @@ }; svg.querySelectorAll(".hm-hit").forEach(hit => { const key = hit.dataset.cell; - hit.addEventListener("click", () => focusCell(hourCellSel === key ? null : key)); + // Select, never toggle. A tap fires the emulated mouseenter and then the + // click on the same block, so a toggle here selected on the first of the + // pair and cleared on the second — the count only appeared on a later tap + // that arrived without a fresh mouseenter. Selecting twice is a no-op. + hit.addEventListener("click", () => focusCell(key)); hit.addEventListener("mouseenter", () => focusCell(key)); }); focusCell(hourCellSel); diff --git a/src/changelog.json b/src/changelog.json index 47856d7..566153a 100644 --- a/src/changelog.json +++ b/src/changelog.json @@ -1,7 +1,7 @@ [ { "date": "2026-08-24", "text": "Each row of the timing panel is now a small chart instead of a number: the band spans the shortest to the typical gap over the last 7 days, and the marker is how long it has been since the last one. Inside the band means there is time yet, off the right-hand end means the puppy is due — and a row with only one event so far says so instead of drawing an empty axis" }, { "date": "2026-08-24", "text": "The timing panel now covers meals too — typical and shortest time between them, alongside the pee and poo gaps — so you can see the feeding rhythm the same way. It is titled just “Timing” now that it is no longer only about bathroom breaks" }, - { "date": "2026-08-24", "text": "The “By hour of day” chart is now tappable: tap any block to read what it counts (“3 meals between 07:00 and 08:00”) just under the chart — until now that number only showed as a hover tooltip, which phones never get. The block you tapped gets a ring; tap it again to clear it" }, + { "date": "2026-08-24", "text": "The “By hour of day” chart is now tappable: tap any block to read what it counts (“3 meals between 07:00 and 08:00”) just under the chart — until now that number only showed as a hover tooltip, which phones never get. The block you tapped gets a ring" }, { "date": "2026-08-21", "text": "The sleep timer pill in the day bar — the one that appears once you've scrolled past the big timer — is now tappable: tap it while the puppy is asleep to log the wake-up, or while awake to log a sleep start, without scrolling back up to the buttons" }, { "date": "2026-08-20", "text": "Added reminders: turn them on in Settings and your phone gets a notification when it's time to sleep (\"Awake for 45 min\") or when there's been no pee, poo or meal for a while. Each one has its own interval, they arrive even with the app closed, and they stay quiet while the puppy is logged as asleep so you're not nagged all night. On iPhone, add Puppy Tracker to your Home Screen first — iOS only allows notifications for installed apps" }, { "date": "2026-08-18", "text": "The sleep button that would just repeat the last one is now disabled: while asleep you can only tap ⏰ Sleep end, and while awake only 😴 Sleep start — no more accidental double taps creating zero-length sleep windows. If you did miss a boundary, you can still add it at the right time from the event log" },