Skip to content

Commit

Permalink
Fix prose sibling heading margin selectors
Browse files Browse the repository at this point in the history
**Why**: It's expected that the intention of these selectors was to match headings within `.usa-prose` following any other content in that prose block. Instead, due to the behavior of `&` in expanding the full selector ancestry, the generated output was along the lines of...

```
*+.usa-prose>h2,*+.usa-prose>h3 {
    margin-top: 1.7em
}
```

This can be interpreted as "any content, followed by a prose block with a heading".
  • Loading branch information
aduth committed Jan 29, 2021
1 parent c5f49dd commit 03a838e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Fix an issue where builds may produce styles in an unpredictable order.
- Fix an issue where `.usa-display` heading font size was rendered larger than intended.
- Fix an issue where `dropdownButton` was using invalid CommonJS syntax when imported from ES module entrypoint.
- Fix an issue where `.usa-prose` heading margins were not applied correctly.

### Internal

Expand Down
25 changes: 15 additions & 10 deletions src/scss/components/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,37 @@
letter-spacing: -0.2px;
}

h2, h3 {
* + & {
margin-top: 1.7em;
}
* + h2,
* + h3 {
margin-top: 1.7em;
}

h4 {
letter-spacing: -0.1px;
}

* + & {
margin-top: 2.5em;
}
* + h4 {
margin-top: 2.5em;
}

h5, h6 {
@include u-font-family('sans');
text-transform: uppercase;

* + & {
margin-top: 3em;
}
+ * {
margin-top: 0.2em;
}
}

* + h5,
* + h6 {
margin-top: 3em;
}

h5 {
letter-spacing: 0.2px;
}

h6 {
@include u-font-size('sans', 'micro');
@include u-font-weight('bold');
Expand Down

0 comments on commit 03a838e

Please sign in to comment.