Make WordPress Core

Opened 21 months ago

Closed 20 months ago

Last modified 20 months ago

#62985 closed defect (bug) (fixed)

Fix layout support classes to be generated with a stable ID

Reported by: darerodz Owned by: audrasjb
Priority: normal Milestone: 6.8
Component: Editor Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

This ticket tracks the merging of PHP files for the following Gutenberg changes:

​https://github.com/WordPress/gutenberg/pull/68210

This fixes a bug reported in ​https://github.com/WordPress/gutenberg/issues/67308 related to the Interactivity API's client-side navigation feature, which these layout classes affect. There was a previous attempt at https://core.trac.wordpress.org/ticket/59681 to solve the issue, but it was insufficient.

Change History (19)

This ticket was mentioned in ​PR #8353 on ​WordPress/wordpress-develop by ​@darerodz.


21 months ago
#1

  • Keywords has-patch has-unit-tests added

This is a backport PR for WordPress 6.9 that includes the following PHP Gutenberg changes:

Trac ticket: https://core.trac.wordpress.org/ticket/62985

This ticket was mentioned in ​Slack in #core-editor by fabiankaegy. ​View the logs.


21 months ago

#3 @joemcgill
20 months ago

  • Keywords needs-testing has-testing-info added
  • Milestone Awaiting Review → 6.8
  • Owner set to joemcgill
  • Status new → reviewing

I'm adding this to the 6.8 milestone for consideration. @fabiankaegy and @Mamaduka could one of you confirm that the current PR addresses the issue reported in the GB repo?

For anyone else wanting to test this, reproduction steps can be found in ​https://github.com/WordPress/gutenberg/issues/67308.

​@darerodz commented on ​PR #8353:


20 months ago
#4

Thanks, @joemcgill, for your review. 🙏

I'm adding tests for the wp_unique_id_from_values() function. They should be ready before these changes are merged.

​@darerodz commented on ​PR #8353:


20 months ago
#5

@joemcgill, I just added PHPUnit tests for wp_unique_id_from_values() if you want to take a look.

#6 @joemcgill
20 months ago

  • Resolution → fixed
  • Status reviewing → closed

In 60038:

Editor: Fix layout support classes to be generated with a stable ID.

This fixes a bug reported in ​https://github.com/WordPress/gutenberg/issues/67308 related to the Interactivity API's client-side navigation feature by replacing the incrementally generated IDs with stable hashes derived from the block's layout style definition.

Fixes #62985.
Props darerodz.

#7 @luisherranz
20 months ago

Thanks @joemcgill!

#8 @peterwilsoncc
20 months ago

  • Keywords needs-patch added; has-patch has-unit-tests needs-testing has-testing-info removed
  • Resolution fixed
  • Status closed → reopened

Reopening this as the wp_unique_id_from_values() function includes an odd _doing_it_wrong() call.

  • There's an unused sprintf in the message as there is no placeholder
  • The empty( $data ) seems a little weird with the function signature wp_unique_id_from_values( array $data, string $prefix = '' ): string, as PHP will fatal if nothing/an incorrect type is passed, and getting a signature for an empty array while weird, seems like it could potentially be useful.

Edit: ​PR created for the first item, but thinking about it further I'm not sure it needs to be type strict at all. wp_unique_id_from_values( 'some string or type' ) could be potentially useful.

Last edited 20 months ago by peterwilsoncc (previous) (diff)

This ticket was mentioned in ​PR #8570 on ​WordPress/wordpress-develop by ​@peterwilsoncc.


20 months ago
#9

  • Keywords has-patch added; needs-patch removed

A little tidy up of the DIW call within wp_unique_id_from_values():

  • Remove the unused sprintf
  • Figure whether the DIW should be used.

Trac ticket: https://core.trac.wordpress.org/ticket/62985

This ticket was mentioned in ​Slack in #core by audrasjb. ​View the logs.


20 months ago

#11 @peterwilsoncc
20 months ago

  • Resolution → fixed
  • Status reopened → closed

In 60075:

Editor: Tidy up _doing_it_wrong() call in wp_unique_id_from_values().

Adds a translator note not to translate the parameter name $data and removes an unused sprintf() that doesn't contain any placeholders.

Props peterwilsoncc, joemcgill.
Fixes #62985.

#12 @joemcgill
20 months ago

In 60079:

Editor: Fix translators note in wp_unique_id_from_values().

Follow up to [60075] to fix a typo.

Props mukesh27, johnbillion.
See #62985.

#13 @darerodz
20 months ago

Thanks, folks, for taking care of this!

#14 @swissspidy
20 months ago

  • Resolution fixed
  • Status closed → reopened

This should use sprintf with a placeholder for the $data part.

#16 @audrasjb
20 months ago

Self assigning for a quick follow-up fix (see the above PR).

#17 @audrasjb
20 months ago

  • Owner changed from joemcgill to audrasjb
  • Status reopened → assigned

#18 @audrasjb
20 months ago

  • Resolution → fixed
  • Status assigned → closed

In 60085:

Coding Standards: Use sprintf() for correct i18n in wp_unique_id_from_values().

Follow-up to [60075], [60079].

Fixes #62985.

#19 @desrosj
20 months ago

Just noting that [60038] is causing some ​failures in test reports from hosts. #63175 has been opened to follow up.

Note: See TracTickets for help on using tickets.