nodejs / nodejs.org

The Node.js® Website
https://nodejs.org
MIT License
6.02k stars 6.17k forks source link

fix: layout word break #6712

Closed araujogui closed 2 months ago

araujogui commented 2 months ago

Description

Change layout's word break to normal

Validation

image

Related Issues

Fixes #6711

Check List

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview May 7, 2024 9:47am
github-actions[bot] commented 2 months ago
Lighthouse Results URL Performance Accessibility Best Practices SEO Report
/en 🟢 98 🟢 100 🟢 100 🟢 91 🔗
/en/about 🟢 99 🟢 100 🟢 96 🟢 91 🔗
/en/about/previous-releases 🟢 98 🟢 100 🟢 100 🟢 92 🔗
/en/download 🟢 98 🟢 100 🟢 100 🟢 91 🔗
/en/blog 🟢 99 🟢 100 🟢 100 🟢 92 🔗
github-actions[bot] commented 2 months ago

Unit Test Coverage Report

Lines Statements Branches Functions
Coverage: 91%
90.04% (588/653) 76.08% (175/230) 92.18% (118/128)

Unit Test Report

Tests Skipped Failures Errors Time
128 0 :zzz: 0 :x: 0 :fire: 6.004s :stopwatch:
canerakdas commented 2 months ago

It seems to overflow content for low-resolution mobile browsers, for example;

https://nodejs-jow7mncue-openjs.vercel.app/en/blog/release/v20.12.0

IMO it might be better to use xs:break-words for mobile resolution

bmuenzenmeyer commented 2 months ago

yeah - we have dueling solutions here now and we need to slow down and consider our use cases and options

NiedziolkaMichal commented 2 months ago

You guys may consider text-align: justify: image

krave1986 commented 2 months ago

I would suggest try

word-break: normal;
overflow-wrap: anywhere;
hyphens: auto;

This will both keep the result closest to the current design and bring hyphens to broken words at the end of the lines.

Another benefit would be that we don't need to concern media query for such cases further.

ovflowd commented 2 months ago

Look we also already tried the hyphens approach. Each approach has its own cons and pros and different side effects.

I think is worth going over git history to see what was already attempted and what not and if whatever proposed works well on all scenarios

tniessen commented 2 months ago

I came across this PR after running into this odd issue and trying to fix it myself. For me, personally, justified alignment and normal word break work fine in combination.

ovflowd commented 2 months ago

@araujogui could you go over the considerations that both me, Caner and Brian mentioned? 👀

araujogui commented 2 months ago

Found out that word-break was introduced in #6680, so I think we can assume that until then it was the browsers defaults (normal). The issue solved in #6680 didn't come back with this PR.