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

Inline elements flowing into each other in flex layout #2359

Closed
cosmqc opened this issue Jan 22, 2025 · 3 comments
Closed

Inline elements flowing into each other in flex layout #2359

cosmqc opened this issue Jan 22, 2025 · 3 comments
Labels
bug Existing features not working as expected

Comments

@cosmqc
Copy link

cosmqc commented Jan 22, 2025

I'm trying to make a leader for a table of contents, the below sample doesn't seem to render as codepen or Safari do.
Codepen and Safari overflow onto the next line (meaning I can hide the overflow with overflow-y/setting the height), but in weasyprint, the span seems to ignore its boundary and overflow into the next box instead of wrapping.

<div class="toc-element">
  <span class="toc-label">
    Introduction
  </span>
  <span class="toc-leader">. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .</span>
  <span class="toc-pageno">4</span>
</div>
.toc-element {
  display: flex;
}

.toc-leader {
  flex: 1;
}

Expected output (codepen), each span staying/wrapping within its own container:
Image

Actual output, spans acting if they were all just inline:
Image

@liZe
Copy link
Member

liZe commented Jan 24, 2025

Hi!

Thanks for the report. I don’t get your rendering, but mine is broken too:

Image

That’s one of many open issues about flex layout, that we’ll work on really soon.

There’s also a leader() function in WeasyPrint that you should definitely use in this case!

@liZe liZe added the bug Existing features not working as expected label Jan 24, 2025
@liZe
Copy link
Member

liZe commented Feb 6, 2025

Part of the problem is the same as #1817: I can’t find anything in the Unicode specification or the CSS specification that explains why we can break lines between spaces and dots.

Let’s focus on the other part of the problem. If we replace dots by letters, we get a very ugly result too. We’ll fix this part.

@liZe
Copy link
Member

liZe commented Feb 6, 2025

Bug is closed in the flex branch, see #2362.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants