-
Notifications
You must be signed in to change notification settings - Fork 4.6k
[Block Cover]: Fix focal point for repeated background #41420
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
Conversation
| } | ||
|
|
||
| if ( ! ( $attributes['hasParallax'] || $attributes['isRepeated'] ) ) { | ||
| if ( ! ( $attributes['hasParallax'] ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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