Repository navigation
Add initialScrollTime to Schedule day and week views - #728
Merged
Merged
Conversation
A day or week grid in a fill-height Schedule always opened at its first hour, so an app that wanted the current time in view had to reach into the grid's markup to scroll it. `initialScrollTime: 'now'` places the current time a third of the way down the visible hours when the grid shows today. A time of day places that time at the top. The grid scrolls once when it mounts, below the sticky day headers, and keeps the user's scroll after that. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
A day or week grid in a fill-height Schedule always opened at its first hour. To show the current time when the grid opens, an app had to reach into the grid's markup: query the
Schedule time gridelement and theschedule-current-time-linetest id, then measure the sticky day headers itself. The Bomi EHR calendar needs exactly this.This adds an
initialScrollTimeoption tocreateScheduleDayViewandcreateScheduleWeeklyView:'now'places the current time a third of the way down the visible hours, so the hour just before it stays in view. It only scrolls when the grid shows today; on any other week the grid opens at its first hour as before. A time outside the grid's hours scrolls as far as the grid allows.{hour, minute?}places that time of day at the top of the visible hours, on any date.The grid scrolls once, in a layout effect when it mounts, so it never visibly jumps. Later renders keep wherever the user has scrolled, including paging, the current-time line's minute tick, and newly loaded events. Switching between Day and Week mounts a new grid, which applies the option again. The position is measured below the sticky header rows, so a tall all-day row doesn't cover the target. The effect reads the current time from
Temporal.Nowinstead ofuseCurrentTime, because that hook's server snapshot is still in place during hydration. The option has no effect inheight="auto", where the grid doesn't scroll vertically.Tests are in Chromium browser tests, since jsdom has no layout:
'now'lands a third of the way down.A new
FillHeightScrolledToNowstory shows the option.pnpm testpasses for the unit and Chromium projects (4664 tests). The WebKit project's three hit-area suites couldn't run because WebKit wouldn't install on this machine; they don't touch Schedule.pnpm smoke:packagepasses.🤖 Generated with Claude Code