Issue with modern-screenshot library when filtering nodes

When using the modern-screenshot library (https://www.npmjs.com/package/modern-screenshot) and filtering out some nodes, the resulted image has the original height element resulting in whitespace on the image.

I tried setting the height manually but that just cuts the image.

I am curios if someone else had this issue and if there is a fix for it.

When I filter nodes I expect the image to not have whitespace, instead, the image has original element height with whitespace where the filtered node was placed.

Here is a sandbox with reproduction: https://codesandbox.io/p/sandbox/modern-screenshot-forked-sp2j8g