Make WordPress Core

Opened 2 months ago

Closed 7 weeks ago

Last modified 7 weeks ago

#61111 closed enhancement (fixed)

Add support for column and row span in grid layout child blocks.

Reported by: isabel_brison's profile isabel_brison Owned by: isabel_brison's profile isabel_brison
Milestone: 6.6 Priority: normal
Severity: normal Version: trunk
Component: Editor Keywords: gutenberg-merge needs-patch
Focuses: Cc:

Description

Children of blocks with grid layout should be able to span multiple grid columns and rows.

To that effect, the following Gutenberg PRs need to be synced to core:

https://github.com/WordPress/gutenberg/pull/58539
https://github.com/WordPress/gutenberg/pull/59057
https://github.com/WordPress/gutenberg/pull/59452

Change History (8)

This ticket was mentioned in PR #6493 on WordPress/wordpress-develop by @isabel_brison.


2 months ago
#1

  • Keywords has-patch added

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

Syncs the changes from https://github.com/WordPress/gutenberg/pull/58539, https://github.com/WordPress/gutenberg/pull/59057 and https://github.com/WordPress/gutenberg/pull/59452 to core.

To test, paste the following markup in a post:

<details>
<summary>test markup</summary>

<div class="wp-block-group">
<p class="has-background" style="background-color:#91ded8">grid item</p>



<p class="has-background" style="background-color:#91ded8">grid item</p>



<p class="has-background" style="background-color:#91ded8">grid item</p>



<p class="has-background" style="background-color:#91ded8">grid item</p>



<p class="has-background" style="background-color:#91ded8">grid item</p>



<p class="has-background" style="background-color:#91ded8">grid item</p>
</div>

</details>

Save and view on the front end. It should show grid items spanning multiple columns and rows:

https://github.com/WordPress/wordpress-develop/assets/8096000/4bf93a72-738a-4da6-80cb-da494f9a4f76

Todo: add tests.

@isabel_brison commented on PR #6493:


2 months ago
#2

I've added a test so marking this one ready for review!

#3 @isabel_brison
8 weeks ago

  • Owner set to isabel_brison
  • Resolution set to fixed
  • Status changed from new to closed

In 58170:

Editor: add column and row spans to grid children.

Adds support for setting spans using grid-column and grid-row properties on children of blocks with grid layout.

Props isabel_brison, andrewserong, peterwilsoncc, mukesh27.
Fixes #61111.

@isabel_brison commented on PR #6493:


8 weeks ago
#4

Committed in r58170.

#5 @peterwilsoncc
7 weeks ago

  • Keywords needs-patch added; has-patch removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

I'm seeing an error running phpunit that a bisect shows is coming from this commit.

It appears to be coming from the Test_Block_Supports_Layout::data_wp_add_parent_layout_to_parsed_block() class which registers parent_block without a blockName property.

I'm unclear whether the regression is in the test suite or a change to graceful handling when registering blocks.

$ ./vendor/bin/phpunit --group dont-run-tests
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.

Notice: Undefined index: blockName in /vagrant/wordpress-develop/src/wp-includes/class-wp-block.php on line 131

Call Stack:
    0.0079     411184   1. {main}() /vagrant/wordpress-develop/vendor/bin/phpunit:0
    0.0100     425440   2. include('phpvfscomposer:///vagrant/wordpress-develop/vendor/phpunit/phpunit/phpunit') /vagrant/wordpress-develop/vendor/bin/phpunit:118
...snip...
    2.3503   50577920  17. Test_Block_Supports_Layout->data_wp_add_parent_layout_to_parsed_block() /vagrant/wordpress-develop/vendor/phpunit/phpunit/src/Util/Annotation/DocBlock.php:421
    2.3503   50578896  18. WP_Block->__construct($block = ['attrs' => ['layout' => ['type' => 'grid']]], $available_context = ???, $registry = ???) /vagrant/wordpress-develop/tests/phpunit/tests/block-supports/layout.php:446

PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

No tests executed!
Version 0, edited 7 weeks ago by peterwilsoncc (next)

#6 @swissspidy
7 weeks ago

Yeah I just noticed the same.

The data_wp_add_parent_layout_to_parsed_block data provider uses new WP_Block without passing a blockName.

#7 @swissspidy
7 weeks ago

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

In 58194:

Editor: fix PHP warnings in tests after [58170].

Props peterwilsoncc.
Fixes #61111.

#8 @SergeyBiryukov
7 weeks ago

In 58196:

Docs: Add a @since note for the changes to safecss_filter_attr() in WP 6.6.

Follow-up to [58170].

See #61111.

Note: See TracTickets for help on using tickets.