WordPress / wporg-news-2021

The WordPress.org News Theme
https://wordpress.org/news/
31 stars 21 forks source link

Enhance content wrapping #414

Closed adamwoodnz closed 9 months ago

adamwoodnz commented 9 months ago

Fixes #406

This PR follows the approach we've taken in the parent theme, enhancing content wrapping by:

  1. Creating balanced headings and captions with text-wrap: balanced
  2. Preventing orphans in paragraphs, lists and blockquotes with text-wrap: pretty

Screenshots

Size Before After
Desktop wordpress org_news_2023_07_synced-patterns-the-evolution-of-reusable-blocks_(1 1920x1080) wordpress org_news_2023_07_synced-patterns-the-evolution-of-reusable-blocks_(1 1920x1080) (1)
wordpress org_news_2023_07_wordpress-6-3-live-product-demo-highlights-recording_(1 1920x1080) (1) wordpress org_news_2023_07_wordpress-6-3-live-product-demo-highlights-recording_(1 1920x1080)
Tablet wordpress org_news_2023_07_synced-patterns-the-evolution-of-reusable-blocks_(iPad) wordpress org_news_2023_07_synced-patterns-the-evolution-of-reusable-blocks_(iPad) (1)
Mobile wordpress org_news_2023_07_synced-patterns-the-evolution-of-reusable-blocks_(Samsung Galaxy S20 Ultra) wordpress org_news_2023_07_synced-patterns-the-evolution-of-reusable-blocks_(Samsung Galaxy S20 Ultra) (1)

Testing

Resize the page observing the text wrapping on the affected elements.

The titles should remain balanced, with no orphans, until the screen is so narrow that the text has to wrap.

Paragraphs and lists should not have orphans until the screen is so narrow that the text has to wrap.

Check browsers that don't support the properties yet (at time of writing Firefox has only just added support for balance, but not pretty, and Safari has no support), they should gracefully degrade, ie. there should be no effect. https://caniuse.com/?search=text-wrap%3Apretty https://caniuse.com/?search=text-wrap%3Abalance