Skip to content

Commit

Permalink
Cover block: Restore default overlay background (#26569)
Browse files Browse the repository at this point in the history
* Restore default Cover overlay background

The default Cover block overlay background was removed. This changed the
style of existing blocks on existing sites.

Restore the default background in such a way that it does not conflict
with theme-provided background-color styles and there is no need to
artificially add extra specificity.

Fix regression: #26545
  • Loading branch information
sirreal authored Nov 2, 2020
1 parent 0d54be6 commit 716884d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/block-library/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Bug Fixes

- Fix a regression ([#26545](https://github.com/WordPress/gutenberg/pull/26545)) where the Cover block lost its default background overlay color
([#26569](https://github.com/WordPress/gutenberg/pull/26569)).

## 2.23.0 (2020-09-03)

### Enhancement
Expand Down
14 changes: 14 additions & 0 deletions packages/block-library/src/cover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@
background-size: auto;
}

/**
* Set a default background color for has-background-dim _unless_ it includes another
* background-color class (e.g. has-green-background-color). The presence of another
* background-color class implies that another style will provide the background color
* for the overlay.
*
* See:
* - Issue with background color specificity: https://github.com/WordPress/gutenberg/issues/26545
* - Issue with alternative fix: https://github.com/WordPress/gutenberg/issues/26545
*/
&.has-background-dim:not([class*="-background-color"]) {
background-color: $black;
}

&.has-background-dim::before {
content: "";
background-color: inherit;
Expand Down

0 comments on commit 716884d

Please sign in to comment.