Bug: wrong class name has-background-dim-0
with opacity 0.5
#27495
Labels
[Block] Cover
Affects the Cover Block - used to display content laid over a background image
Good First Issue
An issue that's suitable for someone looking to contribute for the first time
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Description
When you set the transparency on a cover block to 1 through 4 in the editor, this will be rounded to
0
but is not ignored by the! ratio
check. So it ends up with a class name ofhas-background-dim-0
which has no styling, but defaults to opacity0.5
because of the.wp-block-cover__gradient-background
class default opacity. This happens in the editor WYSIWYG as well as on the front-end.Possible solution 1
gutenberg/packages/block-library/src/cover/shared.js
Lines 58 to 62 in 5cd71f4
Let line #59 also check on the rounded opacity value by adding
|| 0 === Math.round( ratio / 10 )
or similar.Possible solution 2
gutenberg/packages/block-library/src/cover/style.scss
Lines 68 to 75 in 5cd71f4
Have the SCSS file include a
has-background-dim-0
class definition withopacity: 0
by starting the@for
on0
.NB:
I'm not sure if this the only place where this bug occurs. (Not that familiar with the code base ;) )
The text was updated successfully, but these errors were encountered: