Repository navigation
fix(cli): preserve CSS priority during full-page capture - #5316
user-github-me wants to merge 1 commit into
Conversation
jrusso1020
left a comment
There was a problem hiding this comment.
An inline position: static loses to a stylesheet position: fixed !important, and plain el.style.position = value drops an inline !important on restore; this saves the priority, overrides with setProperty('position', 'static', 'important'), and restores value plus priority in the existing cleanup path. I checked main: captureFullPagePlate still uses the plain assignment in both places, and the unrelated changes main made elsewhere in the file do not touch this function, so the fix is still needed and merges cleanly. Restoring an empty value via setProperty('position', '', '') removes the inline declaration, which matches the old behavior for elements that had none. The happy-dom tests run the real evaluate strings and assert computed position during the screenshot and value plus priority afterward, including the screenshot-failure cleanup path. Need: yes · Size: ok · Reuse: existing marker and cleanup path · Simpler: already minimal.
— Rames
What
Respect CSS priority while temporarily neutralizing fixed and sticky elements for website capture's full-page screenshot, then restore their original inline declaration.
Why
With
position: fixed !importantin a stylesheet, assigning an ordinary inlineposition: staticleaves the header fixed infull-page.png. An inlineposition: fixed !importantalso loses its priority when capture restores just its value. If the stylesheet containsposition: relative !important, that header moves into document flow and disappears from the viewport before subsequent asset and HTML extraction.Related work
#2892 established the full-page plate and its temporary position override. #5171 added screenshot limits and interruption reporting. Open #4949 addresses consent-triggered navigation in
captureScrollScreenshots; this change is confined tocaptureFullPagePlateand its CSS restoration. No existing implementation of the priority correction was found.How
Save the inline position's priority alongside its value, override with
position: static !importantfor the plate, and restore both in the existing cleanup path. Remove both temporary markers afterward. The helper's page type lists the two methods it actually uses, allowing the tests to exercise the complete browser expressions without a page type assertion.Test plan
GitHub CI
All 81 latest checks have completed on signed head
7098cec367e1ba3c9daa4350e844a4ea95966d97: 68 successful and 13 skipped, including CodeQL, Windows render, build, tests, regression and all Studio edit-accuracy shards.