Skip to content

Commit

Permalink
Cover block: fix CSS to avoid braking legacy blocks with fixed backgr…
Browse files Browse the repository at this point in the history
…ound
  • Loading branch information
matiasbenedetto committed Apr 22, 2022
1 parent 12ef2e0 commit d491a14
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions packages/block-library/src/cover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -192,28 +192,33 @@
outline: none;
border: none;
box-shadow: none;
}
}

&.has-parallax {
background-attachment: fixed;

// Mobile Safari does not support fixed background attachment properly.
// See also https://stackoverflow.com/questions/24154666/background-size-cover-not-working-on-ios
// Chrome on Android does not appear to support the attachment at all: https://issuetracker.google.com/issues/36908439
@supports (-webkit-overflow-scrolling: touch) {
background-attachment: scroll;
}
.wp-block-cover-image,
.wp-block-cover,
.wp-block-cover__image-background,
video.wp-block-cover__video-background {
&.has-parallax {
background-attachment: fixed;

// Remove the appearance of scrolling based on OS-level animation preferences.
@media (prefers-reduced-motion: reduce) {
background-attachment: scroll;
}
// Mobile Safari does not support fixed background attachment properly.
// See also https://stackoverflow.com/questions/24154666/background-size-cover-not-working-on-ios
// Chrome on Android does not appear to support the attachment at all: https://issuetracker.google.com/issues/36908439
@supports (-webkit-overflow-scrolling: touch) {
background-attachment: scroll;
}

&.is-repeated {
background-repeat: repeat;
background-size: auto;
// Remove the appearance of scrolling based on OS-level animation preferences.
@media (prefers-reduced-motion: reduce) {
background-attachment: scroll;
}
}

&.is-repeated {
background-repeat: repeat;
background-size: auto;
}
}

.wp-block-cover__video-background {
Expand Down

0 comments on commit d491a14

Please sign in to comment.