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).
|
// arrow keys move between days, Escape closes).
|
||||||
let activeDay = $state<number | null>(null);
|
let activeDay = $state<number | null>(null);
|
||||||
let focusDay = $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[]>([]);
|
let bars = $state<HTMLButtonElement[]>([]);
|
||||||
const tabDay = $derived(focusDay ?? s.daily.length - 1);
|
const tabDay = $derived(focusDay ?? s.daily.length - 1);
|
||||||
const tipDay = $derived(activeDay === null ? null : s.daily[activeDay]);
|
const tipDay = $derived(activeDay === null ? null : s.daily[activeDay]);
|
||||||
@@ -178,9 +180,12 @@
|
|||||||
onpointerenter={(e) => {
|
onpointerenter={(e) => {
|
||||||
if (e.pointerType === 'mouse') activeDay = i;
|
if (e.pointerType === 'mouse') activeDay = i;
|
||||||
}}
|
}}
|
||||||
onclick={(e) => {
|
onpointerdown={(e) => {
|
||||||
const mouse = (e as PointerEvent).pointerType === 'mouse';
|
wasOpen = e.pointerType !== 'mouse' && activeDay === i;
|
||||||
activeDay = !mouse && activeDay === i ? null : i;
|
}}
|
||||||
|
onclick={() => {
|
||||||
|
activeDay = wasOpen ? null : i;
|
||||||
|
wasOpen = false;
|
||||||
}}
|
}}
|
||||||
onfocus={() => {
|
onfocus={() => {
|
||||||
focusDay = i;
|
focusDay = i;
|
||||||
|
|||||||
Reference in New Issue
Block a user