You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Full-page screenshots in Chromium lose forcedColors: 'active' rendering, and the page doesn't recover #44041
Run with the Chromium project in mcr.microsoft.com/playwright:v1.65.0-jammy.
Expected behavior
The page keeps forced-colours rendering after every screenshot, and the full-page screenshot is drawn with forced colours.
Actual behavior
The viewport screenshot is fine.
The full-page screenshot comes out without forced colours: normal colours on a white background.
After it, the page stays out of forced-colours rendering. Body text is rgb(0, 0, 0) instead of rgb(255, 255, 255), and later viewport screenshots are wrong too.
matchMedia('(forced-colors: active)').matches still returns true throughout. Only the rendering is lost, not the media query.
The same thing happens with expect(locator).toHaveScreenshot() when the element is taller than the viewport. That's how we found it: all our high-contrast visual regression snapshots came out in light mode after upgrading.
Additional context
It seems to happen whenever Playwright sends Page.captureScreenshot with captureBeyondViewport: true (when the capture doesn't fit the viewport). Screenshots that fit the viewport are unaffected.
The screenshot code (captureBeyondViewport: !fitsViewport) and the media emulation code look the same in 1.58.2 and 1.65.0. Our snapshots rendered correctly with 1.58.2 (Chromium 145), which suggests a change in Chromium rather than in Playwright.
Emulation works correctly without the full-page capture, with either forcedColors set directly or contextOptions: { forcedColors: 'active' }. PLAYWRIGHT_LEGACY_SCREENSHOT=1 makes no difference to a viewport-sized capture. We haven't tried it with a full-page capture.
We haven't tested Firefox, WebKit, or Playwright 1.64.
Hi, I'm the Playwright bot. I reproduced this and checked it without Playwright.
This is a Chromium regression. It reproduces in Playwright 1.65.0 and current 1.66.0-next (c6405a9ebcf74fba1db96a5e358c7462348fbd3e), both using Chromium 158.0.8127.18. Playwright 1.64.0 with Chromium 156.0.8078.4 works. Chromium's Page.captureScreenshot with captureBeyondViewport: true changes the text from white to black while the forced-colors media query stays active. The same commands reproduce it without importing or launching through Playwright.
In my minimal page, the background remains black rather than turning white, but the white text disappears from the full-page image and later viewport images. Firefox and WebKit retain their initial rendering.
Reproduction and results
I extended the existing EM-010 should emulate forcedColors test with this case:
awaitpage.emulateMedia({colorScheme: 'dark',forcedColors: 'active'});awaitpage.setContent('<p>Text</p><div style="height:3000px"></div>');constcolor=()=>page.evaluate(()=>getComputedStyle(document.body).color);constinitialColor=awaitcolor();awaitpage.screenshot();expect(awaitcolor()).toBe(initialColor);awaitpage.screenshot({fullPage: true});expect(awaitpage.evaluate(()=>matchMedia('(forced-colors: active)').matches)).toBe(true);expect(awaitcolor()).toBe(initialColor);// Chromium: black instead of white.
All runs were on Linux (Ubuntu 24.04), not the reported Jammy container.
Playwright
Browser
Mode
Result
1.58.2
Chromium 145.0.7632.6
Headless
Page and tall-element captures preserve white text
1.64.0
Chromium 156.0.8078.4
Headless
Page and tall-element captures preserve white text
1.65.0
Chromium 158.0.8127.18
Headless
Both captures change text to black
1.66.0-next, commit above
Chromium 158.0.8127.18
Headless
Both captures change text to black
Same current commit
Chromium 158.0.8127.18
Headed
Full-page capture changes text to black
Same current commit
Firefox 159.0
Headless
Initial text color survives full-page capture
Same current commit
WebKit 27.2
Headless
Initial text color survives full-page capture
For each published-version comparison, I checked a viewport capture, two large captures, and a later viewport capture. In 1.65.0 and current Chromium, image pixels also confirm the loss of white text, starting with the first large capture. I tested locator('body').screenshot() for the tall-element case, not toHaveScreenshot().
Reapplying page.emulateMedia({ colorScheme: 'dark', forcedColors: 'active' }) restores the page's text color. It does not repair the image already captured.
The linked #15211 concerns caret hiding, not this capture-induced change.
Upstream Chromium report: reproduction without Playwright
Title:Page.captureScreenshot(captureBeyondViewport=true) loses forced-colors text rendering and leaves the page in that state
Known good: Chromium 156.0.8078.4. The identical direct CDP sequence preserves white text there.
Launch Chromium with --headless --remote-debugging-port=0 and a fresh user-data directory. Connect a CDP client and send these commands to a page target:
Expected: capture preserves both the rendered forced colors and the page's state. Actual: full-page capture loses the white text, and subsequent viewport captures remain wrong.
The reproduction uses only browser-process launch and CDP commands; no Playwright screenshot preparation, CSS injection, or cleanup is involved. The fix belongs in Chromium's screenshot/emulation handling. This report is ready for a maintainer to file at https://crbug.com/new; this run cannot file Chromium issues.
Triaged on Linux by the Playwright bot - agent run
Activity
microsoft-playwright-automation commentedon Nov 10, 2026
microsoft-playwright-automation commentedon Nov 10, 2026
Hi, I'm the Playwright bot. I reproduced this and checked it without Playwright.
This is a Chromium regression. It reproduces in Playwright 1.65.0 and current
1.66.0-next(c6405a9ebcf74fba1db96a5e358c7462348fbd3e), both using Chromium 158.0.8127.18. Playwright 1.64.0 with Chromium 156.0.8078.4 works. Chromium'sPage.captureScreenshotwithcaptureBeyondViewport: truechanges the text from white to black while the forced-colors media query stays active. The same commands reproduce it without importing or launching through Playwright.In my minimal page, the background remains black rather than turning white, but the white text disappears from the full-page image and later viewport images. Firefox and WebKit retain their initial rendering.
Reproduction and results
I extended the existing
EM-010 should emulate forcedColorstest with this case:All runs were on Linux (Ubuntu 24.04), not the reported Jammy container.
For each published-version comparison, I checked a viewport capture, two large captures, and a later viewport capture. In 1.65.0 and current Chromium, image pixels also confirm the loss of white text, starting with the first large capture. I tested
locator('body').screenshot()for the tall-element case, nottoHaveScreenshot().Reapplying
page.emulateMedia({ colorScheme: 'dark', forcedColors: 'active' })restores the page's text color. It does not repair the image already captured.The linked #15211 concerns caret hiding, not this capture-induced change.
Upstream Chromium report: reproduction without Playwright
Title:
Page.captureScreenshot(captureBeyondViewport=true) loses forced-colors text rendering and leaves the page in that stateAffected: Chromium 158.0.8127.18, revision
6449d9f9a6a906edff724b7b220199b3fde4615c, Linux.Known good: Chromium 156.0.8078.4. The identical direct CDP sequence preserves white text there.
Launch Chromium with
--headless --remote-debugging-port=0and a fresh user-data directory. Connect a CDP client and send these commands to a page target:Expected: capture preserves both the rendered forced colors and the page's state. Actual: full-page capture loses the white text, and subsequent viewport captures remain wrong.
The reproduction uses only browser-process launch and CDP commands; no Playwright screenshot preparation, CSS injection, or cleanup is involved. The fix belongs in Chromium's screenshot/emulation handling. This report is ready for a maintainer to file at https://crbug.com/new; this run cannot file Chromium issues.
Triaged on Linux by the Playwright bot - agent run
pavelfeldman commentedon Nov 10, 2026
Filed https://issues.chromium.org/issues/583903276
test: forced-colors の VRT を fullPage 撮影なしで撮る