Skip to content

Commit

Permalink
Add border support to the cover block
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw committed Jul 9, 2021
1 parent 34d1a96 commit 935e440
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/block-library/src/cover/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"spacing": {
"padding": true
},
"__experimentalBorder": true,
"color": {
"__experimentalDuotone": "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
"text": false,
Expand Down
8 changes: 7 additions & 1 deletion packages/block-library/src/cover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
padding: 1em;
// This block has customizable padding, border-box makes that more predictable.
box-sizing: border-box;
// Overflow is hidden to handle border radius being applied on the block wrapper.
overflow: hidden;

&.has-parallax {
background-attachment: fixed;
Expand Down Expand Up @@ -39,11 +41,15 @@
* background-color class implies that another style will provide the background color
* for the overlay.
*
* The default background color has been moved to the before pseudo element
* to allow custom border styles. If left on the `.has-background-dim`
* element the color acts as a background to the dotted/dashed borders.
*
* 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"]) {
&.has-background-dim:not([class*="-background-color"])::before {
background-color: $black;
}

Expand Down

0 comments on commit 935e440

Please sign in to comment.