← Back to Pull requests

Clarify image loading during View Transitions #8671

Merged
aurorascharff merged 3 files (287 lines) on Oct 06, 2026 11:07 UTC
View on GitHub
aurorascharff aurorascharff commented on Sep 23, 2026 16:16 UTC
Author

Follow-up to #8658.

Summary

  • clarify that React may wait for qualifying images during any client-rendered <ViewTransition> update

  • compare the same Suspense reveal inside and outside <ViewTransition> in both the <img> and Suspense references

  • use the Suspense retry to activate the image examples without an unrelated startTransition

  • keep the setup concise and describe the observable result after each example

  • remove redundant image alternative text from the profile examples
  • Validation

  • eslint src/content/reference/react-dom/components/img.md src/content/reference/react/Suspense.md

  • node scripts/headingIdLinter.js

  • git diff --check
  • Diff: 287 lines (+155 / -132) across 3 files Reviewer: eps1lon Review duration: 18411m
    All Vouch review confidence checks passed
    Residual risk 0.06 = Change Risk (0.40) × (1 − Review Confidence (0.84)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 287 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.77 · 5 substantive comment(s)
    0.77
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    84%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.339
    Real PR Conversation Timeline
    10 items
    github-actions[bot] github-actions[bot] commented on Sep 23, 2026 16:19 UTC
    Bot

    Size changes

    <details>

    📦 Next.js Bundle Analysis for react-dev

    This analysis was generated by the Next.js Bundle Analysis action. 🤖

    This PR introduced no changes to the JavaScript bundle! 🙌<!-- __NEXTJS_BUNDLE_react-dev -->
    </details>
    <!-- Sticky Pull Request Commentnext-bundle-analysis -->

    eps1lon eps1lon commented on Sep 25, 2026 09:05 UTC
    Reviewer
    Copilot Copilot commented on code on Oct 04, 2026 13:59 UTC
    Code Review
    src/content/reference/react-dom/components/img.md:1
    @@ -125,22 +125,23 @@ To create an explicit preload hint, call [`preload`](/reference/react-dom/preloa
     
     ### Waiting for an image during a View Transition {/*waiting-for-an-image-during-a-view-transition*/}
     
    -During a client-rendered [`<ViewTransition>`](/reference/react/ViewTransition) update, React may wait for an image to load and decode before starting the animation. This applies when a new `<img>` with a non-empty `src` is rendered, or when an existing image's `src` or `srcSet` changes. The image must be inside the `<ViewTransition>` subtree and must not have `loading="lazy"` or an `onLoad` handler. React does not wait for images during synchronous updates.
    +During a Suspense reveal inside a [`<ViewTransition>`](/reference/react/ViewTransition), React waits up to 500 ms for visible images to load before starting the animation. This includes newly rendered `<img>` elements with a non-empty `src` and existing images whose `src` or `srcSet` changes. React does not wait for images with `loading="lazy"` or an `onLoad` handler.

    This wording incorrectly limits image waiting to Suspense reveals. A qualifying image also blocks an ordinary Transition-driven <ViewTransition> update (for example, changing an existing image's src), so readers could wrongly conclude that a Suspense boundary is required. Restore the broader client-rendered View Transition scope.

    Copilot Copilot commented on code on Oct 04, 2026 13:59 UTC
    Code Review
    src/content/reference/react-dom/components/img.md:1
    @@ -125,22 +125,23 @@ To create an explicit preload hint, call [`preload`](/reference/react-dom/preloa
     
     ### Waiting for an image during a View Transition {/*waiting-for-an-image-during-a-view-transition*/}
     
    -During a client-rendered [`<ViewTransition>`](/reference/react/ViewTransition) update, React may wait for an image to load and decode before starting the animation. This applies when a new `<img>` with a non-empty `src` is rendered, or when an existing image's `src` or `srcSet` changes. The image must be inside the `<ViewTransition>` subtree and must not have `loading="lazy"` or an `onLoad` handler. React does not wait for images during synchronous updates.
    +During a Suspense reveal inside a [`<ViewTransition>`](/reference/react/ViewTransition), React waits up to 500 ms for visible images to load before starting the animation. This includes newly rendered `<img>` elements with a non-empty `src` and existing images whose `src` or `srcSet` changes. React does not wait for images with `loading="lazy"` or an `onLoad` handler.
     
    -When a Suspense boundary reveals streamed content inside a `<ViewTransition>`, React may also wait for visible images with a non-empty `src` that do not have `loading="lazy"`. React stops waiting after a timeout so that a slow image does not block the update indefinitely.
    -
    -In this example, the Suspense boundary is wrapped in a `<ViewTransition>` and shows a profile skeleton until the portrait has loaded.
    -
    -For comparison, the second button inserts the same card directly into the DOM. The card appears immediately, and the browser displays the image after it loads:
    +Compare how the same image appears when a Suspense boundary reveals its content inside and outside a `<ViewTransition>`:
     
     <Sandpack>
     
     ```js
    -import { ViewTransition, Suspense, useState, startTransition } from 'react';
    -import { freshImageUrl } from './image.js';
    -import VanillaProfile from './VanillaProfile.js';
    -
    -function Profile({ src }) {
    +import {
    +  ViewTransition,
    +  Suspense,
    +  use,
    +  useState,
    +} from 'react';
    +import { fetchImageSrc } from './image.js';
    +
    +function Profile({ cacheKey }) {
    +  const src = use(fetchImageSrc(cacheKey));
       return (
         <div className="card">
           <img src={src} alt="Jack Pope" width={80} height={80} />

    The PR summary says these profile examples remove redundant alternative text, but this portrait still announces “Jack Pope” immediately before the adjacent text announces the same name. Use an empty alt so screen readers do not hear the name twice.

    Copilot Copilot commented on code on Oct 04, 2026 13:59 UTC
    Code Review
    src/content/reference/react/Suspense.md:1
    @@ -3051,20 +3066,23 @@ hr {
     
     ### Waiting for an image to load {/*waiting-for-an-image-to-load*/}
     
    -When a [`<ViewTransition>`](/reference/react/ViewTransition) animates a Suspense boundary's reveal, React waits for visible images to load, up to a timeout, so the animation doesn't start with a half-loaded image. This only happens during a `<ViewTransition>` update. Adding an `onLoad` handler opts a specific image out, even inside a `<ViewTransition>`.
    -
    -In the example below, the Suspense boundary is wrapped in a `<ViewTransition>` and shows a profile skeleton until the portrait has loaded.
    +When a Suspense boundary reveals content inside a [`<ViewTransition>`](/reference/react/ViewTransition), React waits up to 500 ms for visible images to load before starting the animation. Setting `loading="lazy"` or adding an `onLoad` handler opts an image out.

    The PR description promises to explain why the image-loading examples use startTransition, but this revised section neither uses nor discusses it while the coordinated image example below still calls it. Please explain why this comparison relies on the Suspense reveal whereas the coordinated example marks the initiating update as a Transition, or align the examples and PR description.

    Copilot Copilot commented on code on Oct 04, 2026 13:59 UTC
    Code Review
    src/content/reference/react/Suspense.md:1
    @@ -3051,20 +3066,23 @@ hr {
     
     ### Waiting for an image to load {/*waiting-for-an-image-to-load*/}
     
    -When a [`<ViewTransition>`](/reference/react/ViewTransition) animates a Suspense boundary's reveal, React waits for visible images to load, up to a timeout, so the animation doesn't start with a half-loaded image. This only happens during a `<ViewTransition>` update. Adding an `onLoad` handler opts a specific image out, even inside a `<ViewTransition>`.
    -
    -In the example below, the Suspense boundary is wrapped in a `<ViewTransition>` and shows a profile skeleton until the portrait has loaded.
    +When a Suspense boundary reveals content inside a [`<ViewTransition>`](/reference/react/ViewTransition), React waits up to 500 ms for visible images to load before starting the animation. Setting `loading="lazy"` or adding an `onLoad` handler opts an image out.
     
    -For comparison, the second button performs the same update without React. Nothing waits for the image, so the card appears immediately and the image pops in when it loads:
    +Compare the same boundary inside and outside a `<ViewTransition>`. Inside, React keeps the profile skeleton visible for up to 500 ms while the image loads, so the card can be revealed with its image already in place. Outside, Suspense stops showing the skeleton as soon as the Promise resolves. If the image is still loading, the card appears first and the image pops in afterward:
     
     <Sandpack>
     
     ```js
    -import { ViewTransition, Suspense, useState, startTransition } from 'react';
    -import { freshImageUrl } from './image.js';
    -import VanillaProfile from './VanillaProfile.js';
    +import {
    +  ViewTransition,
    +  Suspense,
    +  use,
    +  useState,
    +} from 'react';
    +import { fetchImageSrc } from './image.js';
     
    -function Profile({ src }) {
    +function Profile({ cacheKey }) {
    +  const src = use(fetchImageSrc(cacheKey));
       return (
         <div className="card">
           <img src={src} alt="Jack Pope" width={80} height={80} />

    The PR summary says these profile examples remove redundant alternative text, but this portrait still announces “Jack Pope” immediately before the adjacent text announces the same name. Use an empty alt so screen readers do not hear the name twice.

    Copilot Copilot commented on code on Oct 04, 2026 13:59 UTC
    Code Review
    src/content/reference/react/Suspense.md:1
    @@ -3272,17 +3284,34 @@ export default function VanillaProfileCard() {
             .profile-card img { border-radius: 50%; background: #dfe3e9; }
             .name { margin: 0 0 4px; font-family: 'Caveat', sans-serif; font-size: 22px; line-height: 28px; font-weight: bold; }
             .bio { margin: 0; font-family: 'Caveat', sans-serif; font-size: 20px; line-height: 26px; }
    +        .avatar-placeholder { width: 80px; height: 80px; border-radius: 50%; background: #dfe3e9; }
    +        .name-placeholder, .bio-placeholder { border-radius: 4px; background: #dfe3e9; color: transparent; }
    +        .name-placeholder { width: 90px; }
    +        .bio-placeholder { width: 220px; height: 52px; }
           </style>
           <div class="profile-card">
    -        <img src="${freshImageUrl()}" alt="Jack Pope" width="80" height="80" />
    +        <div class="avatar-placeholder"></div>
             <div>
    -          <p class="name">Jack Pope</p>
    -          <p class="bio">${quote}</p>
    +          <p class="name name-placeholder">&nbsp;</p>
    +          <p class="bio bio-placeholder">&nbsp;</p>
             </div>
           </div>
    -      <link rel="stylesheet" href="${freshStylesheetUrl()}">
         `);
         doc.close();
    +
    +    const quote = await fetchQuote();
    +    doc.body.innerHTML = `
    +      <div class="profile-card">
    +        <img src="${freshImageUrl()}" alt="Jack Pope" width="80" height="80" />

    This added vanilla profile still duplicates the adjacent “Jack Pope” text in the image alternative text, contrary to the PR summary's stated cleanup. Make the portrait's alt empty here as well.

    copilot-pull-request-reviewer[bot] copilot-pull-request-reviewer[bot] commented on Oct 04, 2026 13:59 UTC
    Reviewer

    <!-- ccr-overview-v2 -->

    Copilot review overview

    🟡 Changes recommended

    The image-waiting scope is incorrectly narrowed, and promised explanation and alternative-text cleanup remain incomplete.

    Review effort: Balanced
    Findings: 1 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> · 4 <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture>

    <details open>
    <summary><strong>Open (5)</strong></summary>

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/medium-v2-light.png" alt="Medium severity" width="62" height="18" align="texttop"></picture> [Clarify View Transition image waiting beyond Suspense reveals](#discussion_r4177970847) · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> [Avoid duplicate portrait alt text for Jack Pope](#discussion_r4177970873) · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> [Explain or align startTransition usage in image examples](#discussion_r4177970893) · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> [Avoid duplicate portrait alt text for Jack Pope](#discussion_r4177970912) · New

  • <picture><source media="(prefers-color-scheme: dark)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.svg"><img src="https://github.githubassets.com/static/images/icons/copilot-code-review/low-v2-light.png" alt="Low severity" width="62" height="18" align="texttop"></picture> [Remove redundant alt text from vanilla profile portrait](#discussion_r4177970937) · New

  • </details>

    <details>
    <summary><strong>What changed in this PR</strong></summary>

    Clarifies how images and fonts load during React View Transitions.

    Changes:

  • Compares Suspense reveals with and without <ViewTransition>.

  • Updates loading explanations and examples for React 19.3.

  • Revises profile and font demonstrations.
  • | File | Description |
    | ---- | ----------- |
    | ViewTransition.md | Clarifies Suspense reveal behavior. |
    | Suspense.md | Updates image, font, and coordinated-loading examples. |
    | img.md | Documents image waiting during View Transitions. |
    </details>

    ---

    💡 Configure MCP servers for context-aware, tailored reviews. <a href="https://docs.github.com/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review?tool=webui#mcp-servers-and-agent-skills" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Learn more in the docs.</a>

    eps1lon eps1lon approved these changes on Oct 06, 2026 10:58 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    aurorascharff aurorascharff
    Labels
    risk: low confidence: 84.3% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.8% (MEDIUM) · Higher = larger blast radius
    39.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 84.3% · Lower = rushed or shallow review
    84.3%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 6.3% · Safe to merge
    6.3%