Skip to content

Conversation

@amustaque97
Copy link
Member

@amustaque97 amustaque97 commented May 28, 2022

What?

In my PR, I have removed the condition isRepeated is checked and because of the condition it was not able to add css property background-postion or object-position.

Why?

Fixes: #40809

How?

I removed the OR (||) condition

Testing Instructions

  1. Create a new page and add a Cover block with an image.
  2. 1.Toggle on the Repeated background option.
    1. Change the focal point settings and publish the page.
    1. Go to the frontend and see that the focal point settings are not applied to the image.
    1. Go back to edit the page, refresh, and see that the focal point settings are saved and applied to the image.

Screenshots or screencast

Screen.Recording.2022-05-29.at.2.05.27.AM.mov

@amustaque97 amustaque97 self-assigned this May 28, 2022
@amustaque97 amustaque97 added [Type] Bug An existing feature does not function as intended [Block] Cover Affects the Cover Block - used to display content laid over a background image labels May 28, 2022
@amustaque97 amustaque97 marked this pull request as ready for review May 28, 2022 20:39
@amustaque97 amustaque97 requested a review from ajitbohra as a code owner May 28, 2022 20:39
}

if ( ! ( $attributes['hasParallax'] || $attributes['isRepeated'] ) ) {
if ( ! ( $attributes['hasParallax'] ) ) {
Copy link
Member

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.

Copy link
Contributor

@ntsekouras ntsekouras May 31, 2022

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

Copy link
Contributor

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.

Copy link
Contributor

@draganescu draganescu left a 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.

@amustaque97
Copy link
Member Author

Closing this PR in favour of #40809 (comment)

@amustaque97 amustaque97 closed this Jun 7, 2022
@johnbillion johnbillion deleted the fix/40809-focal-point-repeated-background branch February 10, 2025 16:43
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] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cover block: focal point not working when 'Repeated background' is toggled on

6 participants