Directory

Add list item wrapper to social links when used in navigation block by talldan · Pull Request #61396 · WordPress/gutenberg · GitHub
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

Add list item wrapper to social links when used in navigation block #61396

Merged
merged 2 commits into from
May 9, 2024

Conversation

talldan
Copy link
Contributor

@talldan talldan commented May 6, 2024

What?

Fixes #61385

Why?

As mentioned in that issue, when the social block is used in the navigation block, the front-end markup has a <ul> nested in a <ul>, when it seems the proper thing to do is have a wrapping <li> tag.

How?

There's an array $needs_list_item_wrapper in the server render callback for the navigation block, and adding social links to that seems to do the trick.

Testing Instructions

  1. Add a navigation block
  2. Add a social link to the navigation block
  3. Save and (pre)view the frontend content
  4. Inspect the markup of the social links block, it should now be wrapped in an <li> tag

Also check that none of the styling is broken (this is my greatest concern with the change).

Screenshots or screencast

Screenshot 2024-05-06 at 4 11 28 pm

@talldan talldan added [Type] Bug An existing feature does not function as intended [Block] Navigation Affects the Navigation Block [Block] Social Affects the Social Block - used to display Social Media accounts labels May 6, 2024
@talldan talldan self-assigned this May 6, 2024
@talldan talldan requested a review from ajitbohra as a code owner May 6, 2024 08:12
@carolinan
Copy link
Contributor

This solves the invalid markup, I would say this can be merged when the PHP coding standard issue is fixed.

There is always a risk that the markup change makes existing third party CSS invalid, so there needs to be a dev note/ added to the "What's new in Gutenberg" etc; some outreach to extenders.

Copy link

github-actions bot commented May 8, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @timofey-drozhzhin.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: timofey-drozhzhin.

Co-authored-by: talldan <talldanwp@git.wordpress.org>
Co-authored-by: carolinan <poena@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@talldan talldan force-pushed the add/list-item-wrapper-to-social-links-in-nav-block branch from 8f4e346 to 8659498 Compare May 9, 2024 03:31
@talldan
Copy link
Contributor Author

talldan commented May 9, 2024

Thanks @carolinan!

@talldan talldan added the Needs Dev Note Requires a developer note for a major WordPress release cycle label May 9, 2024
@talldan talldan enabled auto-merge (squash) May 9, 2024 03:35
@talldan talldan merged commit ded5a39 into trunk May 9, 2024
63 checks passed
@talldan talldan deleted the add/list-item-wrapper-to-social-links-in-nav-block branch May 9, 2024 04:07
@github-actions github-actions bot added this to the Gutenberg 18.4 milestone May 9, 2024
@juanmaguitar juanmaguitar mentioned this pull request May 29, 2024
45 tasks
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 [Block] Social Affects the Social Block - used to display Social Media accounts Needs Dev Note Requires a developer note for a major WordPress release cycle [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nesting Social Icons under Navigation results in invalid HTML
2 participants