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

Adds default wp-block-list class to list block #36676

Closed
wants to merge 7 commits into from

Conversation

luminuu
Copy link
Member

@luminuu luminuu commented Nov 19, 2021

Description

This pull request adds a default class wp-block-list to the list block on the frontend. The issue for this is #12420. The change enhances the developer experience as it enables developers to use a specific selector for the list block, without having to rely on any parent elements or using too many :not() statements.

How has this been tested?

Local environment: MAMP with WP 5.8.2 installed on macOS Catalina
Tested by adding a new list block to a post. Also changed various settings as well as adding additional CSS classes at the advanced tab.

Screenshots

Types of changes

New feature (non-breaking change which adds functionality)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@luminuu luminuu requested a review from ajitbohra as a code owner November 19, 2021 17:31
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @luminuu! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Nov 19, 2021
@ZebulanStanphill ZebulanStanphill added the [Block] List Affects the List Block label Nov 19, 2021
@ZebulanStanphill
Copy link
Member

ZebulanStanphill commented Nov 19, 2021

There's a much simpler way of doing this, if I recall correctly. Just remove this line in the List block.json.

By default, the block editor generates a class name from the name in the block.json and adds it to the block's markup automatically. The reason the List block didn't have it was that it was explicitly disabling the feature.

Also, it's likely that several tests will need to be updated to reflect the altered markup.

@luminuu
Copy link
Member Author

luminuu commented Nov 19, 2021

There's a much simpler way of doing this, if I recall correctly. Just remove this line in the List block.json.

By default, the block editor generates a class name from the name in the block.json and adds it to the block's markup automatically. The reason the List block didn't have it was that it was explicitly disabling the feature.

Also, it's likely that several tests will need to be updated to reflect the altered markup.

This was actually my first try but it didn't seem to have any effect. But I'm happy to learn if I just missed something else.

I also didn't expect that many tests to fail but they just do because of the altered markup with the class, as it seems.

@ZebulanStanphill ZebulanStanphill added the [Type] Enhancement A suggestion for improvement. label Nov 19, 2021
@luminuu
Copy link
Member Author

luminuu commented Nov 19, 2021

I've checked again on the code and it looks like I actually missed something while testing earlier. I reverted my previous change and removed the className property in block.json as suggested by @ZebulanStanphill.

I also updated a few files related to tests to make them pass with the new markup, still working on that.

@luminuu luminuu requested review from nerrad and ntwb as code owners November 21, 2021 17:15
@markhowellsmead
Copy link

markhowellsmead commented Nov 23, 2021

See also #12420 (comment).

@luminuu luminuu requested a review from ellatrix as a code owner January 11, 2022 20:04
@luminuu luminuu closed this May 5, 2022
@luminuu luminuu deleted the add-classname-to-list-block branch May 5, 2022 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] List Affects the List Block First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants