[Block Cover]: Fix focal point for repeated background#41420
[Block Cover]: Fix focal point for repeated background#41420amustaque97 wants to merge 2 commits intotrunkfrom
Conversation
| } | ||
|
|
||
| if ( ! ( $attributes['hasParallax'] || $attributes['isRepeated'] ) ) { | ||
| if ( ! ( $attributes['hasParallax'] ) ) { |
There was a problem hiding this comment.
Hi, @amustaque97
This code should only run when the Cover block is set to use the featured image. I think we might have a different problem here.
There was a problem hiding this comment.
I think @Mamaduka is right here. Also this check seems weird:
if ( ! ( $attributes['hasParallax'] || $attributes['isRepeated'] ) ) {
For example we conditionally set focalPoint which doesn't seem right. If we wanted to conditionally add things we should also do it in the editor by hiding controls etc..
--cc @glendaviesnz @draganescu
There was a problem hiding this comment.
thanks for the ping - will leave it to @draganescu to comment as I haven't looked at the server rendering side of the featured image support to-date.
There was a problem hiding this comment.
This is interesting. I'll test this. The code is meant to duplicate the logic in the block's save component:
const isImgElement = ! ( hasParallax || isRepeated );
and the logic following that. Looks like something is amiss. But simply removing this part of the condition does not look like a fix.
From the issue's video https://d.pr/v/NNeZLM it looks like the problem is in the save component as there is no toggling on of the featured image feature.
|
Closing this PR in favour of #40809 (comment) |
What?
In my PR, I have removed the condition
isRepeatedis checked and because of the condition it was not able to add css propertybackground-postionorobject-position.Why?
Fixes: #40809
How?
I removed the OR (||) condition
Testing Instructions
Screenshots or screencast
Screen.Recording.2022-05-29.at.2.05.27.AM.mov