Scroll the now line into view on navigation
All checks were successful
/ build (push) Successful in 1m34s
/ deploy (push) Successful in 16s

When displaying the schedule, scroll it such that the now line is on the
left to make what is displayed by default the most immediately useful
information.
This commit is contained in:
Hornwitser 2025-07-16 19:58:01 +02:00
parent ae1c653af6
commit 9013e85ff0
2 changed files with 16 additions and 1 deletions

View file

@ -77,6 +77,7 @@
<td :colSpan="totalColumns">
<div
v-if="nowOffset !== undefined"
ref="nowLine"
class="now"
:style="` --now-offset: ${nowOffset}`"
>
@ -677,6 +678,16 @@ const nowOffset = computed(() => {
offset += group.width;
}
});
const nowLine = useTemplateRef("nowLine"); // If I name the ref now, the element disappears?!
function scrollToNow() {
if (nowLine.value) {
nowLine.value.scrollIntoView({ behavior: "smooth", inline: "start", block: "nearest" });
}
}
defineExpose({
scrollToNow,
});
</script>
<style scoped>