w3c / w3c/csswg-drafts

[css-overflow] Proposing `scroll-start`: allowing overflow scroll to not always start at 0 on 1st layout pass

Open
#6,986 21 comments 31 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-overflow-4 css-scroll-snap-2
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

📄 Explainer

Currently, JavaScript needs to show up at "never the right time" to adjust a scroll position to a specific starting place. This CSS property proposal seeks to remedy page load scroll jank by allow specifying a scroll-start position with a specific or by giving a child element scroll-start-target: auto at which point an absolute length is derived from the element and the scroll direction.


Example: set the start position to an absolute value:

:root { --nav-height: 100px }

.snap-scroll-y {
  scroll-start-y: var(--nav-height);
}

Example: set the start position to a snap child

.snap-scroll-inline {
  overflow-inline: scroll;
  scroll-snap-type: inline mandatory;
}

.snap-scroll-inline > #snap-start {
  scroll-start-target-inline: auto;
}

There's a lot more use cases and details (like interaction with fragment navigation) about the proposal in the Explainer

Would love to present the details of the explainer to the CSSWG for feedback 🙂

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked css-scroll-start Explainer and the discussion in this issue, including its fragment-navigation considerations. The proposal covers new scroll-start and scroll-start-target properties, but no specification file, test, or implementation entry point is identified. Done would require CSSWG feedback and a resolved direction for the proposal.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.