From f8701885c5a9029abc231056643a37aaf03fa808 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Mon, 9 Nov 2026 20:44:32 -0500 Subject: [PATCH] Today button lines up today's day number at the top Co-Authored-By: Claude Opus 5.5 --- assets/javascripts/calendar.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/calendar.js b/assets/javascripts/calendar.js index 1dd1d7e..307a98e 100644 --- a/assets/javascripts/calendar.js +++ b/assets/javascripts/calendar.js @@ -26,9 +26,13 @@ document.addEventListener('DOMContentLoaded', function() { (function() { window.scrollToToday = function() { + // Line up today's day number near the top of the window. Centering the whole cell hid the number + // above the window when the day is busy (tall cell). const todayElement = document.getElementById('today'); if (todayElement) { - todayElement.scrollIntoView({ behavior: 'smooth', block: 'center' }); + const target = todayElement.querySelector('.day-num') || todayElement; + const top = target.getBoundingClientRect().top + window.scrollY - 10; + window.scrollTo({ top: Math.max(top, 0), behavior: 'smooth' }); } };