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

Strange gap after text in right justified flexbox #643

Open
vinnymac opened this issue Oct 28, 2024 · 0 comments
Open

Strange gap after text in right justified flexbox #643

vinnymac opened this issue Oct 28, 2024 · 0 comments

Comments

@vinnymac
Copy link

vinnymac commented Oct 28, 2024

Bug report

Description / Observed Behavior

Apologies if this was already reported elsewhere, I looked around and could not find a similar reported issue.

When rendering a div with some text in it, or a span that includes a comma or period, I am finding that the text is not properly justified to the right. For example, if you have

<div style={{ display: 'flex', justifyContent: 'flex-end' }}>$67.00</div>

Demo

The text will not be rendered at the end of that div, but instead includes a gap.

Expected Behavior

I would expect the text to be rendered like it is when not using a period ., like this.

Reproduction

You can find the reproduction here.

Additional Context

Satori version: 0.11.2

I've tried a variety of fonts, html entities, and styles, but can't get the layout to function as expected.
If someone has dealt with this in the past, I'd love to know how they were able to work around this.

EDIT: I am not sure why this works, but I have found that wrapping the . character in its own span seems to correctly justify the text, perhaps the way it measures character widths becomes inaccurate when mixing varying width text nodes?

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

2 participants
@vinnymac and others