w3c / w3c/csswg-drafts

[css-view-transitions-2] Clip captured snapshots to viewport for elements

Open
#9,481 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-view-transitions-2
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

Currently when an element is snapshotted for a ViewTransition its captured in its entirety (modulo implementation constraints), see here.

But for the root the snapshot is clipped to viewport, see here.

The reason for this divergence is:

  • The root is likely to be large in a lot of cases and rendering it completely is wasteful of memory/compute.
  • A partially onscreen element may be brought more onscreen during the transition animations so all its content is conservatively painted.

Its unclear if the tradeoff above makes sense in all cases, maybe the author should decide this based on the transition animations they will be creating? @jakearchibald has brought up cases where the root is slightly scrolled during the transition (from a header which animates away) and needs a small margin of offscreen content to be painted.

This intersects with https://github.com/w3c/csswg-drafts/issues/8282 but I'm filing it separately so the use-case is not lost. Since https://github.com/w3c/csswg-drafts/issues/8282 could be limited to which elements participate in a transition while this is about how much content of an element is painted.

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 with the CSS View Transitions capture-the-image algorithm linked in the issue, then compare the root snapshot behavior with element snapshots. Read the related issue 8282 for overlapping scope and use the described scrolling and partially onscreen-element cases to define the desired behavior. Done requires an agreed specification change, including the clipping or painting rules.

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.