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

Navigation Block: block wrapper class name applied to both outer element and its child element #62690

Open
talldan opened this issue Jun 20, 2024 · 0 comments · May be fixed by #62804
Open

Navigation Block: block wrapper class name applied to both outer element and its child element #62690

talldan opened this issue Jun 20, 2024 · 0 comments · May be fixed by #62804
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

@talldan
Copy link
Contributor

talldan commented Jun 20, 2024

Description

If you inspect the markup of a navigation block with the overlay turned off (makes it easier to reproduce), the wp-block-navigation class name is applied twice, once to the outer <nav> and once to its child <ul>:

<nav class="wp-block-navigation is-layout-flex wp-block-navigation-is-layout-flex" aria-label="Navigation 2">
<ul class="wp-block-navigation__container  wp-block-navigation">

Blocks should only have the wrapper classname on the outermost element.

The bug seems to be caused by get_block_wrapper_attributes being used to compute the attributes of the <ul> element:

$container_attributes = get_block_wrapper_attributes(
array(
'class' => 'wp-block-navigation__container ' . $class,
'style' => $style,
)
);

A concern is that changing this might cause some issues, it'd require a dev note as it may break some styles, but I think it needs to be fixed to ensure themes don't end up with unsual style rules like ul.wp-block-navigation.

Step-by-step reproduction instructions

  1. Add a naviation block
  2. Turn off the overlay
  3. Preview the frontend
  4. Inspect the markup

Screenshots, screen recording, code snippet

No response

Environment info

Reproduced on latest trunk core/gutenberg

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@talldan talldan added [Type] Bug An existing feature does not function as intended [Block] Navigation Affects the Navigation Block labels Jun 20, 2024
@up1512001 up1512001 linked a pull request Jun 24, 2024 that will close this issue
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 24, 2024
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.

1 participant