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
Text: Unexpected line wraps in Safari with Fill mode #6323
Comments
@swissspidy I'm able to reproduce this at least in Safari, looks like it doesn't always appear, seems to depend on the window size (or ratio?). Is quite easy to reproduce when resizing the window. For example: |
Another case of unexpected wraps in Safari: https://adiabeticchef.com/web-stories/cakes-and-adc/ |
Huh, this is not a fun bug. Moving it to the Sprint backlog for an initial investigation to figure out if we can fix this. |
Findings so far: However, it looks like Safari is rendering the font a little bit differently than in chrome, it seems to be a tiny bit larger. Found some topics with similar issues and suggestions e.g. this and this and quite a few others, however, no solution so far. Here are two screenshots, one Chrome and one Safari with exactly the same Page size. All the numbers (width/height, fontSize, etc.) match 100%, however, in case of Safari, the font seems to be larger (e.g. the word Thoughts? @merapi You worked on the fonts quite a lot, perhaps you have any insights here? |
Information from Pascal: Apparently this is a long-standing issue with Safari where fractional font-sizes are not correctly handled: https://bugs.webkit.org/show_bug.cgi?id=46987 Should we close this issue as non-fixable? |
@choumx Any thoughts on this one? With Safari having issues with fractional font sizes (basically rounding up/down to nearest 0.5/1.0), there's not much we can do here without relying on JS to detect the wrapping.
So really seems like a wontfix unfortunately 😞 |
Interesting bug. I think we can try deliberately reducing font sizes only on Safari by 0.5px to undo this Webkit behavior:
This can cause the opposite problem (underflow) on some text fields, but it might be desirable tradeoff in terms of UX. |
Any suggestions on how to target Safari on the frontend then? |
Looks like there isn't a clean way to do this in pure CSS, so I'd try user agent detection in JS. E.g.
|
We'd need to do this on the frontend though, not in the editor. So we can't just use JS, and I don't think amp-script works in stories. |
Oh right. Can we do UA detection from the request header i.e. look for @media not all and (min-resolution:.001dpcm) { @media {
p > span { font-size: calc(100% - 0.5px); }
}} Seems to work: https://codepen.io/choumx/pen/dyvdqdV 🥴 |
Thanks Miina! I think it looks better since at least it avoids text legibility issues due to overflow. We could also consider only supporting integer (pixel) font sizes in the editor. 😱 Let's run this by UX and product and see what they think. |
The font sizes are responsive in the FE and even if set in full pixels in the editor, it would still vary when viewing a story. |
Yea sorry I meant applying font-size rounding to all stories in the FE, which would make text more deterministic across browsers but less deterministic between editor and FE. Not as excited about this. |
@choumx Any updates on this / next steps? On applying font-size rounding to all stories in the FE: do you mean rounding font size down for FE? The width and height are also responsive and in |
Confirmed with UX that the hack to reduce font-size by 0.5px in Safari is OK. |
Verified in QA |
Bug Description
Original report: https://wordpress.org/support/topic/box-doesnt-wrap-text-correctly/
Story: https://www.acec.nl/web-stories/de-notenkrakerrrr/
There are unexpected line wraps on page 9 (the third to last one) in Safari, while the story displays correctly in Firefox and Chrome.
Expected Behaviour
No line wraps, same behavior everywhere.
Steps to Reproduce
Screenshots
Safari:
Firefox:
Chrome:
Additional Context
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance Criteria
Implementation Brief
The text was updated successfully, but these errors were encountered: