feat(calendar): auto-scroll day/week views to current time on open - #259
Merged
Conversation
CHANGELOG.md is an append-only historical log with no splitting path. The existing hook already exempts tests, generated files, and node_modules; root-level CHANGELOG belongs in the same category.
Users opening day or week view landed at midnight and had to scroll to find the current-time indicator. A useLayoutEffect now positions the scroll container so "now" sits ~40% from the top (40% past / 60% future), with a 7 AM fallback when today is not in the visible range.
h4yfans
added a commit
that referenced
this pull request
May 6, 2026
feat(calendar): auto-scroll day/week views to current time on open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Auto-scroll calendar day and week views so the current-time indicator lands near the top of the viewport when the user opens the page, instead of stranding them at midnight.
Why
Users opening day or week view saw 00:00 at the top of the scroll container. The "now" indicator was rendered, but off-screen — they had to scroll down to find the present time. On a 24h × 96px-per-hour timeline (2304px), that's a meaningful hit on every view open / navigation.
Requested behavior: current time at roughly 40% from the top (40% past / 60% future visible).
How
use-scroll-to-current-time.tsthat setsscrollTop = currentOffset - viewportHeight * 0.4viauseLayoutEffect(pre-paint, no flash of midnight).scrollRefinto each view'soverflow-y-autocontainer. Could not reuse the existinggridRefbecause it's attached to the inner grid (for marquee bounding-box math), not the scroll viewport.containsToday, not on every date change — so paging through future days preserves the user's manual scroll position; the snap only re-applies when crossing the today boundary.CHANGELOG.mdfrom the 800-line module limit. The existing hook already exempts tests/generated files; an append-only historical log belongs in the same category.Type
feat— new featureTest plan
scrollTopmath that's hard to meaningfully unit-test without a real layout engine. Happy to add jsdom coverage if preferred.Checklist