Make WordPress Core

#53954 closed defect (bug) (reported-upstream)

Non numeric value in focal point picker breaks cover block

Reported by: alexholsgrove's profile AlexHolsgrove Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.8
Component: Editor Keywords: close
Focuses: ui Cc:

Description

By entering a non numeric value into the left/top input fields for the cover block focal point picker causes the block to error.

To test, enter a letter into either box, and the block will break, displaying the message "This block has encountered an error and cannot be previewed."

Viewing the code editor shows the values for attributes object-position and data-object-position as NaN.

<!-- wp:cover {"url":"http://example.com/wp-content/uploads/2021/08/placeholder-960x560-1.jpg","id":126,"focalPoint":{"x":null,"y":"0.50"}} -->
<div class="wp-block-cover has-background-dim"><img class="wp-block-cover__image-background wp-image-126" alt="" src="http://example.com/wp-content/uploads/2021/08/placeholder-960x560-1.jpg" style="object-position:NaN% 50%" data-object-fit="cover" data-object-position="NaN% 50%"/><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
<p class="has-text-align-center has-large-font-size"></p>
<!-- /wp:paragraph --></div></div>
<!-- /wp:cover -->

Change History (4)

#1 @costdev
22 months ago

Hi @AlexHolsgrove, thanks for reporting this issue!

The patch for this ticket on Gutenberg, which checks for a NaN value in the FocalPointPicker component, looks like it will also fix this issue.

#2 @AlexHolsgrove
22 months ago

Thanks @costdev, happy to close this ticket.

#3 @costdev
22 months ago

  • Keywords close added

You're welcome @AlexHolsgrove! I've marked the ticket for closure.

#4 @hellofromTonya
22 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

Thanks @costdev and @AlexHolsgrove for confirming. Closing this ticket as reported upstream in https://github.com/WordPress/gutenberg/issues/33617.

Note: See TracTickets for help on using tickets.