Skip to content

Add initialScrollTime to Schedule day and week views - #728

Merged
czarandy merged 1 commit into
mainfrom
schedule-initial-scroll-time
Oct 14, 2026
Merged

czarandy merged 1 commit into
mainfrom
schedule-initial-scroll-time

Conversation

@czarandy

Copy link
Copy Markdown
Owner

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 grid element and the schedule-current-time-line test id, then measure the sticky day headers itself. The Bomi EHR calendar needs exactly this.

This adds an initialScrollTime option to createScheduleDayView and createScheduleWeeklyView:

  • '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.
  • Leaving the option out keeps the current behavior.

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.Now instead of useCurrentTime, because that hook's server snapshot is still in place during hydration. The option has no effect in height="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 grid that doesn't show today stays at the top.
  • A time of day lands at the top.
  • Paging keeps the user's scroll.

A new FillHeightScrolledToNow story shows the option. pnpm test passes 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:package passes.

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
silver-ui-site Ready Ready Preview Oct 14, 2026 9:23pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
silver-ui Ignored Ignored Preview Oct 14, 2026 9:23pm UTC

@czarandy
czarandy merged commit 31b2036 into main Oct 14, 2026
4 checks passed
@czarandy
czarandy deleted the schedule-initial-scroll-time branch October 14, 2026 21:41

This branch was successfully deployed

1 active deployment
Preview – silver-ui-site — e121d06d Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant