fix(timeline): keep a focused point's card when another point loses the pointer

A pointer leaving any point target closed whichever card was open, and a
blur did the same. With the pointer resting on one line's point and the
keyboard on another (the focus scrolls the chart, so the resting pointer
leaves the first point), the focused point lost its card and focusing it
again fired nothing. A point now releases only its own card, and hands it
back to the focused point when there is one.

The lab-marker journey drove into this when the menu click left the
pointer over a value point. It now sets that up on purpose and asserts the
card survives the pointer leaving, in place of the retry that could never
reopen a card on an already focused target.
This commit is contained in:
Marc-André Bombeck committed 2026-11-05 17:13:40 +01:00
1 parent 7b4c67b372
commit 0882ebd79f
3 files changed
+129 -37

No files matched your search

+12 -7
View File
@@ -866,13 +866,18 @@ test("a lab marker is picked, drawn as its readings, read on its own and kept",
'[data-slot="timeline-point-target"][data-series="lab:bm-ferritin"][data-t="fe-1"]',
);
const tip = page.locator('[data-slot="timeline-point-tip"]');
// A CI run focused the target and no tip opened. The cause is not pinned
// down (the tips layer unmounts while the chart has no layout, which is
// one candidate); focus again until the tip opens.
await expect(async () => {
await target.focus();
await expect(tip).toHaveAttribute("data-t", "fe-1", { timeout: 1_000 });
}).toPass({ timeout: 10_000 });
// A pointer resting on another line's point, as the menu click can leave
// it: the focus takes the card, and that point losing the pointer (the
// focus scrolls the chart from under it) must not close the card.
await page
.locator('[data-slot="timeline-point-target"][data-series="WEIGHT"]')
.last()
.hover();
await expect(tip).toHaveAttribute("data-series", "WEIGHT");
await target.focus();
await expect(tip).toHaveAttribute("data-t", "fe-1");
await page.mouse.move(0, 0);
await expect(tip).toHaveAttribute("data-t", "fe-1");
await expect(tip).toContainText("22 ng/mL");
await expect(tip).toContainText("Laborbefund März");