Make the by-hour heatmap blocks tappable
The count behind a block was only ever reachable through its <title> tooltip,
which needs a pointer — on a phone there was no way to find out whether a dark
block meant two meals or five. Each cell now carries a transparent hit rect
that names it in a caption under the chart ("3 meals between 07:00 and
08:00"), the same string the tooltip shows, so hover and tap agree. The
focused cell takes an accent ring and tapping it again clears it.
The hit rect claims the 1px spacing between cells and half the gap to the
neighbouring rows, which takes the target from ~13x31 to ~13x38 CSS px on a
360px-wide screen; the rows still tile without overlapping and stay clear of
the hour labels. Width is capped by fitting 24 hours across the chart, so a
mis-tap lands on a neighbouring hour — the caption names the range it hit,
which makes that self-correcting.
The focused cell is held outside the render so a background sync can't wipe
what is being read; its count is recomputed each pass, so the caption stays
current. The caption is aria-live, which also gives screen readers a route to
the numbers that role="img" on the svg otherwise closes off.
This commit is contained in:
+9
-1
@@ -662,7 +662,8 @@ dialog menu {
|
||||
stroke-width: 1.5;
|
||||
}
|
||||
|
||||
.weight-point-info {
|
||||
.weight-point-info,
|
||||
.hour-point-info {
|
||||
margin: 6px 4px 0;
|
||||
min-height: 1.2em;
|
||||
text-align: center;
|
||||
@@ -1013,6 +1014,13 @@ input.switch:checked::after { transform: translateX(18px); }
|
||||
.lg[hidden] { display: none; }
|
||||
|
||||
.chart-svg .hm-cell { stroke: none; }
|
||||
/* Focused block: an accent ring, drawn at full opacity so it stays visible on
|
||||
the palest (zero-count) cells. */
|
||||
.chart-svg .hm-cell.hm-active {
|
||||
stroke: var(--accent);
|
||||
stroke-width: 1.2;
|
||||
}
|
||||
.chart-svg .hm-hit { fill: transparent; cursor: pointer; }
|
||||
.chart-svg .hm-pee { fill: var(--pee); }
|
||||
.chart-svg .hm-poo { fill: var(--poo); }
|
||||
.chart-svg .hm-eat { fill: var(--eat); }
|
||||
|
||||
Reference in New Issue
Block a user