niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.47k stars 4.8k forks source link

Screenshot 'position: fixed' level is not corrent. #3149

Open promise96319 opened 7 months ago

promise96319 commented 7 months ago

Bug reports:

<div style={{ position: 'relative' }}>
    <div style={{ position: 'fixed', left: 0, top: 0 }} />
</div>

When 'position: fixed' has a parent/grandparent node that has the style 'position: relative', the screenshot's level is not correct.

Because the renderContentStack method render 'position: fixed' after 'position: relative'。But 'position: fixed' should render in the top level, it should be relative to the viewport or 'transform: xxx', not 'position: relative'

Specifications: