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

Border radius is not applied to overlay element #44262

Closed
mikachan opened this issue Sep 19, 2022 · 10 comments · Fixed by #44286
Closed

Border radius is not applied to overlay element #44262

mikachan opened this issue Sep 19, 2022 · 10 comments · Fixed by #44286
Assignees
Labels
[Block] Cover Affects the Cover Block - used to display content laid over a background image [Block] Post Featured Image Affects the Post Featured Image Block

Comments

@mikachan
Copy link
Member

Description

If the Post Featured Image or Cover block has a border-radius set in theme.json, and the block has an overlay set, the border-radius is not applied to the overlay element.

With the Post Featured image block, the overlay shows with square corners on top of the border-radius:
image

For the featured image, I think we should apply the border-radius to the overlay, as well as the image.

With the Cover block, the border-radius does not appear at all (it's applied to the container element):
image

For the cover block, it looks like the border-radius needs to be applied to the nested image and the overlay.

This issue was found when testing the Canary style variation in Twenty Twenty-Three.

Step-by-step reproduction instructions

  1. Activate the Twenty Twenty-Three theme and select the Canary variation
  2. Open the canary.json file in styles directory and add the following under styles.blocks:
"core/cover": {
	"border": {
		"radius": "100px 0 0 0"
	}
},
  1. Notice that the border-radius is not applied correctly to the overlay on the front end

To test the featured image, use the following markup in place of the cover block in the single template:

<!-- wp:post-featured-image {"overlayColor":"contrast","dimRatio":50,"align":"wide"} /-->

The border-radius for the featured image is already set in canary.json, under core/post-featured-image. Notice how this is not applied correctly.

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

@mikachan mikachan added [Block] Cover Affects the Cover Block - used to display content laid over a background image [Block] Post Featured Image Affects the Post Featured Image Block labels Sep 19, 2022
@talldan
Copy link
Contributor

talldan commented Sep 20, 2022

@talldan
Copy link
Contributor

talldan commented Sep 20, 2022

Post featured image is possibly fixed by #44213. In my testing border radius with overlay looks ok on latest trunk:
Screen Shot 2022-09-20 at 1 55 42 pm

I haven't tested cover, but the fix in #44213 was only for post featured image.

@aaronrobertshaw
Copy link
Contributor

With the Cover block, the border-radius does not appear at all (it's applied to the container element):

The Cover block hasn't officially adopted border support to my knowledge. It has been in the works (#41153) but there have been some issues around how it functions in the editor which meant progress stalled while we focused on other areas.

I'm not sure what the official recommendations are around attempting to style via theme.json when the block hasn't fully adopted a particular block support. I imagine it's a case of buyer beware?

That said, I'll bring #41153 back up-to-date in the next couple of days and see if recent work has addressed the block popover positioning issues that were holding it back.

@RahiDroid
Copy link
Contributor

Screenshot 2022-09-20 at 12 38 49 PM

I am still able to reproduce the issue on latest trunk. #44276 would potentially fix the issue along with one more issue with the overlay. I will do some testing and will mark it ready for review.

For the cover block, I agree with @aaronrobertshaw above, the block doesn't officially support the border controls, yet.

@aaronrobertshaw aaronrobertshaw self-assigned this Sep 20, 2022
@aaronrobertshaw
Copy link
Contributor

I can also replicate the issue for the post featured image block. I'll have a fix up for review in a few minutes. It appears we just need the .wp-block-post-featured-image__overlay class in our feature level selectors for the block's border support.

@aaronrobertshaw
Copy link
Contributor

aaronrobertshaw commented Sep 20, 2022

I've put up a PR to fix the issue for the Post Featured Image block in: #44286.

Feel free to give it a review!

@RahiDroid
Copy link
Contributor

Not related to this ticket, but #44276 fixes an issue with the featured image overlay's border colors.

@aaronrobertshaw @mikachan Would be great if you could help me with a review! If it looks good, maybe it can be cherry-picked with the above PR for this issue.

@gOuTM
Copy link

gOuTM commented Sep 21, 2022

I would also apreciate if Cover block will have the ability to have hover effects as well..

@aaronrobertshaw
Copy link
Contributor

@RahiDroid I missed your ping until now, sorry.

While doing some extra testing yesterday I realised there were some problems with general implementation of the Post Featured Image block's overlays when it came to borders. I've only just pushed the fixes I had to #44286.

My PR linked above also addresses some discrepancies in the rendered markup between the editor and frontend. I'll comment on #44276 as I think it might be worth closing that one if that's ok with you?

@RahiDroid
Copy link
Contributor

@aaronrobertshaw, I have shared my thoughts on your PR; looks great! 🎉

there were some problems with general implementation of the Post Featured Image block's overlays when it came to borders

I believe the rendering of the overlay in the editor when opacity is 0 was the only issue. Though it doesn't affect the functionality, I agree it should definitely be removed for consistency in markup.

I think it might be worth closing that one if that's ok with you?

Sure, please go ahead. Also, add the Backport label on your PR to ensure it gets backported if we happen to push in any more code with the WP release.

@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Nov 30, 2022
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 [Block] Post Featured Image Affects the Post Featured Image Block
Projects
None yet
6 participants