Skip to content

[Block Library - Navigation]: Fix vertical layout#37009

Merged
ntsekouras merged 1 commit into
trunkfrom
fix/navigation-block-vertical-layout
Dec 3, 2021
Merged

[Block Library - Navigation]: Fix vertical layout#37009
ntsekouras merged 1 commit into
trunkfrom
fix/navigation-block-vertical-layout

Conversation

@ntsekouras

@ntsekouras ntsekouras commented Nov 30, 2021

Copy link
Copy Markdown
Contributor

Fixes: #36902

This PR fixes a regression introduced here: #36292.

Testing instructions

  1. In a page/post add a Navigation block and add a couple of items
  2. Change the layout orientation to vertical (do not change content justification)
  3. Save
  4. View the frontend and observe that the Navigation is vertical now

In general I think something like this should be used to get the default block layout in edit function. Now in Navigation block we provide some layout defaults which seems that it shouldn't - I haven't checked in depth yet as the block itself is really convoluted.

The specific problem was that we needed the --layout-direction attribute which wasn't added if layout.justifyContent was empty.

The logic about setCascadingProperties needs more looking. I noticed the 'spread' of items in vertical orientation (Search in Navigation, Social Links) and I believe there must be similar css rules like this fix.

Screen.Recording.2021-11-30.at.8.39.43.PM.mov

@ntsekouras ntsekouras added [Type] Regression Related to a regression in the latest release [Block] Navigation Affects the Navigation Block Backport to WP Beta/RC labels Nov 30, 2021
@ntsekouras ntsekouras self-assigned this Nov 30, 2021
@jasmussen

Copy link
Copy Markdown
Contributor

Thanks for the PR. What's a good way to test it?

@ntsekouras

Copy link
Copy Markdown
Contributor Author

Thanks for the PR. What's a good way to test it?

Sorry about that 😄 - I updated the PR's description

@ntsekouras ntsekouras force-pushed the fix/navigation-block-vertical-layout branch from 20fbbd3 to c8d14bd Compare December 1, 2021 08:54
@jasmussen

Copy link
Copy Markdown
Contributor

Thank you. Tests well for me. I can't speak well to the inner workings, but I'll be happy to give a thumbs up if you have high confidence in this one.

@ntsekouras

Copy link
Copy Markdown
Contributor Author

Thank you. Tests well for me. I can't speak well to the inner workings, but I'll be happy to give a thumbs up if you have high confidence in this one.

In general we need to review the whole setCascadingProperties code as it seems to have coupled the layout abstraction with specific block needs. Until then though, this is needed, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Navigation Affects the Navigation Block [Type] Regression Related to a regression in the latest release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Navigation block: vertical orientation not working

3 participants