Make WordPress Core

Opened 10 years ago

Closed 8 years ago

#28449 closed enhancement (wontfix)

Prevent widows

Reported by: benoitchantre's profile benoitchantre Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9.1
Component: Formatting Keywords:
Focuses: Cc:

Description

A good practice of typography is to avoid widows and orphans in a text.

On small screens, this becomes more important because we have more widows.

Would it be possible to automatically insert a non-breaking space before the last word of any text (title, paragraph, list item, etc.).

Attachments (2)

28449-the_content-orphans.patch (640 bytes) - added by dcondrey 10 years ago.
patch
28449-the_content-orphans-v2.patch (4.5 KB) - added by dcondrey 9 years ago.
28449-the_content-orphans-v2.patch : Filter

Download all attachments as: .zip

Change History (13)

#1 @samuelsidler
10 years ago

  • Component changed from General to Editor

#2 @SergeyBiryukov
10 years ago

  • Component changed from Editor to Formatting

#3 @dcondrey
10 years ago

  • Keywords has-patch added

#4 follow-up: @SergeyBiryukov
10 years ago

This should probably be added as a filter rather than hardcoded into the_content().

#5 @ericlewis
10 years ago

This is a problem that should be solved. I've implemented JS libraries like balance text to avoid orphans.

Having said that, I think it's intrusive for a CMS to try to fix this problem. Browsers should figure out a native solution, and I've tried to push a proposal in the CSSWG to accomplish this.

@dcondrey
9 years ago

28449-the_content-orphans-v2.patch : Filter

#6 in reply to: ↑ 4 @dcondrey
9 years ago

Replying to SergeyBiryukov:

This should probably be added as a filter rather than hardcoded into the_content().

Hi,
I adjusted my patch, as per your suggestion, making it a filter. I also enhanced it further to avoid relying on regex and incorporated a couple of parameters to manipulate the number of words which should wrap and the characters that should be filtered for.

#7 @dcondrey
8 years ago

  • Keywords reporter-feedback added

#8 follow-up: @ericlewis
8 years ago

  • Keywords close added; has-patch reporter-feedback removed

I'm going to suggest we close this as wontfix, and follow-up with the CSS Working Group about pushing this forward in the spec.

#9 in reply to: ↑ 8 ; follow-up: @dcondrey
8 years ago

Replying to ericlewis:

I'm going to suggest we close this as wontfix, and follow-up with the CSS Working Group about pushing this forward in the spec.

Appears to already be in the works.. CSS Fragmentation Module Level 3 https://drafts.csswg.org/css-break/#breaking-controls

#10 in reply to: ↑ 9 @benoitchantre
8 years ago

Replying to dcondrey:

Replying to ericlewis:

I'm going to suggest we close this as wontfix, and follow-up with the CSS Working Group about pushing this forward in the spec.

Appears to already be in the works.. CSS Fragmentation Module Level 3 https://drafts.csswg.org/css-break/#breaking-controls

I haven't tested it, but it should work in many browsers : http://caniuse.com/#search=widows.

I think we can close this issue ; it's better to use CSS to solve that.

--

Update

Tested with Chrome : it only works for print media, not screen

Last edited 8 years ago by benoitchantre (previous) (diff)

#11 @ericlewis
8 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

text-wrap: balanced will be in CSS4 as well. Closing this out, apologies for the wait @benoitchantre :)

Note: See TracTickets for help on using tickets.