Skip to content

Commit d5260bb

Browse files
authored
Replace u-inline-block with u-rescue-orphan, include text-decoration inheritance (#1976)
1 parent e099664 commit d5260bb

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

.changeset/strange-toys-bake.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
'@cloudfour/patterns': minor
33
---
44

5-
Add `u-inline-block` utility
5+
Add `u-rescue-orphan` utility to fine-tune where text breaks occur as space allows

src/utilities/display/demo/inline-block.twig

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<div class="u-border-md u-pad-1" style="max-width: 11em;">
2+
<a href="#">
3+
Look how the last two words <span class="u-rescue-orphan">stay together</span>
4+
</a>
5+
</div>

src/utilities/display/display.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
display: block;
1414
}
1515

16-
/// Set `display` to `inline-block`
17-
.u-inline-block {
16+
/// Attempt to keep chunks of text together as space allows
17+
.u-rescue-orphan {
1818
display: inline-block;
19+
text-decoration: inherit;
1920
}

src/utilities/display/display.stories.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Canvas, Meta, Story } from '@storybook/addon-docs';
22
import hiddenVisuallyDemo from './demo/hidden-visually.twig';
33
import clearfixDemo from './demo/clearfix.twig';
4-
import inlineBlockDemo from './demo/inline-block.twig';
4+
import rescueOrphanDemo from './demo/rescue-orphan.twig';
55

66
<Meta title="Utilities/Display" />
77

@@ -32,10 +32,10 @@ The `u-clearfix` class forces a container to expand to fit floated children.
3232
<Story name="Clearfix">{clearfixDemo}</Story>
3333
</Canvas>
3434

35-
## Inline Block
35+
## Rescue Orphan
3636

37-
The `u-inline-block` class sets the `display` property to `inline-block`. This can be used to discourage inline elements from breaking across multiple lines.
37+
The `u-rescue-orphan` class can wrap the last few words of a chunk of text, attempting to keep them together unless space limitations force a break. This can help reduce the chance of [a typographic orphan](https://en.wikipedia.org/wiki/Widows_and_orphans) in some situations.
3838

3939
<Canvas>
40-
<Story name="Inline Block">{inlineBlockDemo}</Story>
40+
<Story name="Rescue Orphan">{rescueOrphanDemo}</Story>
4141
</Canvas>

0 commit comments

Comments
 (0)