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

Inline style rule for full-height Cover Block in 5.7 can't easily be overridden #29705

Open
markhowellsmead opened this issue Mar 10, 2021 · 9 comments
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Type] Enhancement A suggestion for improvement.

Comments

@markhowellsmead
Copy link

markhowellsmead commented Mar 10, 2021

What problem does this address?

The new full-height button on the Cover Block adds a style attribute to the container, containing min-height: 100vh. This can only be overridden by Theme CSS with an unreliable [style="min-height:100vh"] selector.

The need for overriding the rule is e.g. in the event that the site has a header bar taking up e.g. 150px at the top of the page. Then, the first Cover Block would need to be min-height calc(100vh - 150px), so that the bottom edge of the Block isn't below the fold.

What is your proposed solution?

Apply the CSS rule through an appropriate CSS class name, which can then be overridden by the Theme CSS if necessary.

@markhowellsmead markhowellsmead changed the title Full-height button on Cover Block adds inline CSS Inline style rule for full-height Cover Block in 5.7 can't easily be overridden Mar 10, 2021
@DhrRob
Copy link

DhrRob commented Mar 15, 2021

+1.

Right now, this is only solvable through hacky CSS. Such as:
.wp-block-cover[style="min-height:100vh"] { min-height: calc( 100vh - 75px ) !important; }

@talldan
Copy link
Contributor

talldan commented Mar 19, 2021

There's an input field for adjusting the height, which is why it's an inline style:
Screenshot 2021-03-19 at 1 04 54 pm

@talldan
Copy link
Contributor

talldan commented Mar 19, 2021

I could see how that wouldn't work if it needed to take into account a pixel value though.

@talldan talldan added [Block] Cover Affects the Cover Block - used to display content laid over a background image [Type] Enhancement A suggestion for improvement. labels Mar 19, 2021
@talldan
Copy link
Contributor

talldan commented Mar 19, 2021

Labelled as an enhancement, but it probably needs some more thought as to what the right solution is.

I suppose one option is that by default a classname is used, but when the user adjusts the input it switches to an inline style.

edit: It's worth reading through the PR to see why it was implemented the way it was - #26615

@markhowellsmead
Copy link
Author

This is still a problem. It also doesn't take svh units into account, which would fix problems for mobile users. Perhaps a class name for this specific instance would be a better way to go.

@markhowellsmead
Copy link
Author

Bumping this -- it's still a problem for theme and plugin developers.

@markhowellsmead
Copy link
Author

Still a problem.

@markhowellsmead
Copy link
Author

Bumping this -- it's still a problem for theme and plugin developers. Copying in @WordPress/outreach for feedback.

@cbirdsong
Copy link

Related:

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 [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants