music: hours tooltip opens on tap (focus no longer closes it straight away)
All checks were successful
Deploy production / deploy (push) Successful in 1m7s
All checks were successful
Deploy production / deploy (push) Successful in 1m7s
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
// arrow keys move between days, Escape closes).
|
||||
let activeDay = $state<number | null>(null);
|
||||
let focusDay = $state<number | null>(null);
|
||||
// Whether the tapped bar was already open before this tap (focus opens it first).
|
||||
let wasOpen = false;
|
||||
let bars = $state<HTMLButtonElement[]>([]);
|
||||
const tabDay = $derived(focusDay ?? s.daily.length - 1);
|
||||
const tipDay = $derived(activeDay === null ? null : s.daily[activeDay]);
|
||||
@@ -178,9 +180,12 @@
|
||||
onpointerenter={(e) => {
|
||||
if (e.pointerType === 'mouse') activeDay = i;
|
||||
}}
|
||||
onclick={(e) => {
|
||||
const mouse = (e as PointerEvent).pointerType === 'mouse';
|
||||
activeDay = !mouse && activeDay === i ? null : i;
|
||||
onpointerdown={(e) => {
|
||||
wasOpen = e.pointerType !== 'mouse' && activeDay === i;
|
||||
}}
|
||||
onclick={() => {
|
||||
activeDay = wasOpen ? null : i;
|
||||
wasOpen = false;
|
||||
}}
|
||||
onfocus={() => {
|
||||
focusDay = i;
|
||||
|
||||
Reference in New Issue
Block a user