Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolute-positioned, inline elements don't display when they have a relative-positioned parent with overflow: hidden #2330

Open
cosmqc opened this issue Dec 17, 2024 · 0 comments

Comments

@cosmqc
Copy link

cosmqc commented Dec 17, 2024

Hi team,

The below code snippet shows a minimal use case where I would expect the text 'This test has passed.' to show on the page. Using WeasyPrint v63.1, the text is not visible, but can be selected/copied when highlighting the page (i.e. it is being rendered).

When generating a PDF, it seems absolute children of relative parents that are using overflow: hidden aren't displayed at all. This issue looks similar to #996 but no flex boxes are used.
This seems to happen for all inline elements (<strong>, <span>, <em>, <abbr> tested) and other elements using display: inline (<div> tested). It displays correctly in my usual browser (Safari v18.2, including in print mode), and on this CodePen.

I'd be keen to have a crack at fixing it, but I'd be lost on where to start in the codebase or at what could be causing it.
Any tips would be awesome.

<html>

<head>
    <style>
        #parent {
            position: relative;
            overflow: hidden;
        }

        #child {
            position: absolute;
        }
    </style>
</head>

<body>
    <span id="parent">
        <span id="child">
            This test has passed.
        </span>
    </span>
</body>

</html>

Resulting PDF:
bug.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant