Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grow width in navigation is not working #68753

Open
Pixelous opened this issue Jan 17, 2025 · 3 comments · May be fixed by #68780
Open

Grow width in navigation is not working #68753

Pixelous opened this issue Jan 17, 2025 · 3 comments · May be fixed by #68780
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@Pixelous
Copy link

Pixelous commented Jan 17, 2025

Description

Hi,

Grow width in navigation is not working on front end.

Please see an attached video:

Header-.-Template-part-.-Barbara-Schmid-.-Editor-.-WordPress.webm

This is how it looks on front end, please see an attached screenshot:

Image

Kind regards

@Pixelous Pixelous added the [Type] Bug An existing feature does not function as intended label Jan 17, 2025
@Rishit30G
Copy link
Contributor

Thanks for raising this issue,

I was able to reproduce the issue, could find the grow-width working, sharing the screenshot for the same:

Image

Image

Image

Image

You can try to follow the order of components in my list view, hope that helps 🙇🏻

Thanks

@yogeshbhutkar
Copy link
Contributor

yogeshbhutkar commented Jan 20, 2025

Thank you, @Pixelous, for bringing up this issue! The problem occurs in your case because the social links block is being used inside a navigation block.

The width grow behavior is controlled by the wp-container-content-${id} class, which applies the flex-grow: 1 property. However, when social links are nested within a navigation block, the wp-container-content-${id} class gets assigned to the child of the navigation menu item. As a result, the flex-grow: 1 property doesn't take effect as intended.

Edit:
The social links block gets wrapped within the list item wrapper because of the following line:

$needs_list_item_wrapper = apply_filters( 'block_core_navigation_listable_blocks', static::$needs_list_item_wrapper );

It also makes sense to wrap it within the list item wrapper to keep the corresponding block markup organized. Implemented in this PR ( Issue )

@yogeshbhutkar
Copy link
Contributor

yogeshbhutkar commented Jan 20, 2025

I believe this qualifies as a bug for two key reasons:

  1. Compatibility within core/navigation block:
    The social links block is allowed as a direct descendant of the core/navigation block. Therefore, features like width grow should work seamlessly without requiring the block to be moved out of the core/navigation block. These features should function as expected while nested within it.

  2. Impact on blocks requiring a list item wrapper:
    Blocks that rely on a list item wrapper—such as those specified here:

    private static $needs_list_item_wrapper = array(
    'core/site-title',
    'core/site-logo',
    'core/social-links',
    );

    —or any custom block added later that needs a list item wrapper will encounter the same issue. If these blocks utilize flex-grow, the property won't work correctly due to being wrapped within the list item.

Also, the current implementation behaves differently within the editor and the frontend.

A potential fix would be to also apply the flex-grow: 1 style to the list item wrapper when self-stretch is set to fill. This should fix the bug in the Social Icons block as well as other custom blocks that might require a list item wrapper.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jan 20, 2025
@t-hamano t-hamano added the [Block] Navigation Affects the Navigation Block label Jan 21, 2025
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 [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants