Make WordPress Core

Opened 4 months ago

Closed 2 months ago

#54130 closed defect (bug) (fixed)

force_balance_tags breaks new gallery block

Reported by: glendaviesnz Owned by: hellofromTonya
Milestone: 5.9 Priority: normal
Severity: major Version: 5.9
Component: Formatting Keywords: has-patch commit
Focuses: Cc:

Description

The refactored gallery block uses a nested <figure><figure></figure></figure> structure, as recommended by w3c for image collections.

If a site has the use_balanceTags option set to 1, then the Gallery block breaks on save as force_balance_tags restructures it from <figure><figure></figure></figure> to <figure></figure><figure></figure>.

This is because figure is not listed as a directly nestable element at https://core.trac.wordpress.org/browser/trunk/src/wp-includes/formatting.php#L2485

Change History (12)

This ticket was mentioned in PR #1678 on WordPress/wordpress-develop by glendaviesnz.


4 months ago

  • Keywords has-patch added

The refactored gallery block uses a nested <figure><figure></figure></figure> structure, as recommended by w3c for image collections.

If a site has the use_balanceTags option set to 1, then the Gallery block breaks on save as force_balance_tags restructures it from <figure><figure></figure></figure> to <figure></figure><figure></figure>.

This PR adds figure as as a directly nestable element, which it is under the current html specs.

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

#2 @SergeyBiryukov
4 months ago

  • Component changed from Gallery to Formatting
  • Milestone changed from Awaiting Review to 5.9

#3 @prbot
4 months ago

talldan commented on PR #1678:

@glendaviesnz There are some unit tests for balanceTags. It looks like all that needs to be done is update this array for this change to be covered:
https://github.com/WordPress/wordpress-develop/blob/de822e8fb02e65bea74e9fa75b889461ef234bb3/tests/phpunit/tests/formatting/balanceTags.php#L8-L16

#4 @prbot
4 months ago

talldan commented on PR #1678:

@glendaviesnz There are some unit tests for balanceTags. It looks like all that needs to be done is update this array for this change to be covered:
https://github.com/WordPress/wordpress-develop/blob/de822e8fb02e65bea74e9fa75b889461ef234bb3/tests/phpunit/tests/formatting/balanceTags.php#L8-L16

#5 @prbot
4 months ago

glendaviesnz commented on PR #1678:

There are some unit tests for balanceTags. It looks like all that needs to be done is update this array for this change to be covered:

Thanks, have update the test.

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


3 months ago

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


3 months ago

#8 @hellofromTonya
2 months ago

  • Keywords commit added

PR 1678 is ready for commit.

#9 @hellofromTonya
2 months ago

  • Owner set to hellofromTonya
  • Status changed from new to reviewing

Assigning to me for commit review and prep.

#10 @hellofromTonya
2 months ago

There's possibility the new v2 gallery block may be reverted during Beta (before RC) due to mobile instability with migrating from v1 to v2 gallery blocks. Noting here in the event it is reverted. However in discussions with @glendaviesnz, moving v2 gallery block to 6.0 should not result in structural changes. Thus, this patch can be committed as it will be needed regardless if v2 does move to 6.0.

#12 @hellofromTonya
2 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

Incorrectly marked the ticket number in the commit. It belongs to this ticket.

In 52188:

Formatting: Add additional support for single and nestable tags in force_balance_tags().

Adds track and wbr support for single tags.

Adds article, aside, details, figure, and section for nestable tags.

Updates tests.

Follow-up to [5805], [21828], [45929].

Props glendaviesnz, costdev, talldanwp, ramonopoly, sergeybiryukov.
Fixes #50225.

Note: See TracTickets for help on using tickets.