Skip to content

[Regression]: forcedColors emulation is lost after page.screenshot({ fullPage: true }) (Chromium 158) #44057

Closed as duplicate

Description

Last Good Version

1.64.1

First Bad Version

1.65.0

Steps to reproduce

  1. Clone https://github.com/lemonsqrl-diffy/playwright-forced-colors-fullpage
  2. npm install
  3. npx playwright install chromium
  4. npm test

The whole test:

test('forced colors survive a fullPage screenshot', async ({ page }) => {
  await page.setViewportSize({ width: 800, height: 600 });
  await page.emulateMedia({ forcedColors: 'active' });
  await page.goto(pathToFileURL(path.join(__dirname, 'page.html')).href); // 3000px tall, one button with background rgb(102, 255, 102)

  const read = () =>
    page.$eval('#button', (el) => ({
      background: getComputedStyle(el).backgroundColor,
      forcedColorsMedia: matchMedia('(forced-colors: active)').matches,
    }));

  const afterLoad = await read();
  await page.screenshot({ path: 'viewport.png' });
  const afterViewport = await read();
  await page.screenshot({ path: 'fullpage.png', fullPage: true });
  const afterFullPage = await read();

  for (const [step, r] of Object.entries({ afterLoad, afterViewport, afterFullPage })) {
    expect.soft(r.forcedColorsMedia, `${step}: (forced-colors: active) matches`).toBe(true);
    expect.soft(r.background, `${step}: background is forced`).not.toBe('rgb(102, 255, 102)');
  }
});

Expected behavior

emulateMedia({ forcedColors: 'active' }) keeps applying after a fullPage: true screenshot, as it does on 1.64.1. The button background stays the forced system colour rgb(255, 255, 255) after load, after a viewport screenshot, and after the full-page screenshot, and the full-page PNG is rendered with forced colors.

Actual behavior

On 1.65.0, after page.screenshot({ fullPage: true }) the button's computed background goes back to the authored rgb(102, 255, 102), while matchMedia('(forced-colors: active)') still returns true. The full-page PNG is also captured without forced colors: the button pixel is rgb(102, 255, 102) on 1.65.0 and rgb(255, 255, 255) on 1.64.1. A viewport-sized screenshot does not trigger it.

Playwright Chromium after load after viewport screenshot after fullPage screenshot
1.64.1 156.0.8078.4 rgb(255, 255, 255) rgb(255, 255, 255) rgb(255, 255, 255)
1.65.0 158.0.8127.18 rgb(255, 255, 255) rgb(255, 255, 255) rgb(102, 255, 102)

It fails deterministically. The environment below is Windows, and the same regression also fails on Linux CI (ubuntu). 1.66.0-alpha-2026-11-10 (also Chromium 158.0.8127.18) behaves the same as 1.65.0.

Additional context

This looks like the same beyond-viewport capture class as two earlier reports, now showing up for forced colors:

1.65.0 is the first release on Chromium 158, so the forced-colors loss may be a side effect of how that fix restores emulation state after a beyond-viewport capture.

A workaround keeps forced colors on 1.65.0, in both the computed style and the PNG: resize the viewport to the document height and take a normal screenshot instead of using fullPage: true.

Environment

System:
  OS: Windows 11 10.0.26300
  CPU: (24) x64 13th Gen Intel(R) Core(TM) i9-13900KS
  Memory: 61.42 GB / 127.69 GB
Binaries:
  Node: 24.22.1
  npm: 11.16.0
npmPackages:
  @playwright/test: 1.65.0 => 1.65.0

Activity

  1. microsoft-playwright-automation commented on Nov 11, 2026

    @microsoft-playwright-automation
  2. microsoft-playwright-automation commented on Nov 11, 2026

    @microsoft-playwright-automation
    Contributor

    Hi, I'm the Playwright bot. I couldn't finish triaging this issue: the agent did not run. The agent run has the details.

    Triaged by the Playwright bot - agent run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions