`overflow: hidden` breaks order of tags in PDF/UA
Hello,
I'm facing an issue where the order of tags is generated out of order if an element is styled with overflow: hidden.
Minimal example:
<html lang="en">
<head>
<title>Test</title>
<style>
div { margin-bottom: 10rem; }
.strange { overflow: hidden; }
</style>
</head>
<body>
<div>before</div>
<div class="strange">this is last</div>
<div>after</div>
</body>
</html>
from weasyprint import HTML
if __name__ == "__main__":
html = HTML("./test.html")
html.write_pdf('test.pdf', pdf_variant="pdf/ua-1")
This results in the following tags being generated:
Is there a way to generate the tag at the expected place?
Hi!
This is another problem caused by #2444. We’re currently working on #2363, could you try the pdf/ua branch? It’s not ready to be used in production, but it should already help.
Thanks for the quick reply!
With pdf/ua it looks somewhat different but still the middle tag is generated last.
Here’s what I get using PAC.
I think that it’s closer to what you want 😄. Which tool do you use?
(And I’m surprised by all these artifacts, did you add some decorations in your example?)
No, I've kept the example as posted above. I was using Adobe Acrobat.
No, I've kept the example as posted above. I was using Adobe Acrobat.
Hmm… That’s the order of the drawing stream, not the order of the tag tree. I’ll test as soon as I can get my Windows VM working…
order of the drawing stream, not the order of the tag tree
🤦 You're right. The tag order is correct with pdf/ua branch.
I’ve also removed useless artifacts.