Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover Block: Overlay is only possible in 10-steps instead of 1 - Disable Rounding #51625

Open
hanneslsm opened this issue Jun 18, 2023 · 2 comments · May be fixed by #59891
Open

Cover Block: Overlay is only possible in 10-steps instead of 1 - Disable Rounding #51625

hanneslsm opened this issue Jun 18, 2023 · 2 comments · May be fixed by #59891
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image Needs Technical Feedback Needs testing from a developer perspective. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@hanneslsm
Copy link

Description

I want to add a grid to a cover block. For that I have png with black lines.
On top I am adding a gradient as overlay, to make the black lines more subtle. However, it's not possible to add custom values such as 95 or 98, it automatically rounds down or up to 90 or 100 instead.

Step-by-step reproduction instructions

  1. Add a cover block with a background
  2. Try to add an overlay with 95%

Screenshots, screen recording, code snippet

Screen.Recording.2023-06-18.at.16.24.56.mp4

Environment info

  • WP 6.2.2
  • GB 19.1
  • Custom theme

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@t-hamano
Copy link
Contributor

@hanneslsm
Thanks for the report.

As for the number of steps for the cover block overlay, it seems that this has been changed several times over the years.

I believe the current step number is limited to 10 because the CSS selector (has-background-dim-{number}) is generated from this step number and the opacity is applied individually:

@for $i from 0 through 10 {
// Keep .wp-block-cover__gradient-background for v8 deprecation
.wp-block-cover__gradient-background.has-background-dim.has-background-dim-#{ $i * 10 },
.wp-block-cover__background.has-background-dim.has-background-dim-#{ $i * 10 } {
opacity: $i * 0.1;
}
}

If this for statement is rewritten for all steps, i.e., to loop 100 times, the number of steps may be able to set back to 1.
However, I am concerned that the generated CSS capacity will increase.

Perhaps this could be solved by outputting the opacity inline, independent of the CSS selector.

For that reason, I would like to mark this issue as Enhancement.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] Cover Affects the Cover Block - used to display content laid over a background image labels Jun 19, 2023
@annezazu annezazu added this to Polish Jul 19, 2023
@annezazu annezazu moved this to Needs development in Polish Jul 19, 2023
@akasunil akasunil linked a pull request Mar 15, 2024 that will close this issue
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Mar 15, 2024
@skorasaurus skorasaurus added the Needs Technical Feedback Needs testing from a developer perspective. label Apr 2, 2024
@akasunil
Copy link
Member

@t-hamano I have created PR based on your suggestion for this issue. #59891

@annezazu annezazu removed this from Polish Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image Needs Technical Feedback Needs testing from a developer perspective. [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants