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

List Item: Add border support #63541

Merged
merged 3 commits into from
Aug 15, 2024
Merged

Conversation

aaronrobertshaw
Copy link
Contributor

@aaronrobertshaw aaronrobertshaw commented Jul 15, 2024

Part of: #43241

What?

Adopts border support for individual list items.

Why?

  • Offers greater design flexibility
  • Improves consistency in design tooling with other blocks

How?

  • Adopts all the available border block supports
  • Leaves the border controls as optional to match the dimension controls
  • Defines a custom selector for borders so that the global styles only target top-level List Items

Testing Instructions

  • In the site editor, add a List block with a few items, including a nested list or two, to a page
  • Style List Item blocks via Global Styles and confirm the editor and frontend display correctly
  • Override the global styles on a single List Item block instance and confirm they display appropriately in the editor and frontend
  • Test applying border styles to a block instance that is nested within another list

Screenshots or screencast

Screen.Recording.2024-08-09.at.8.25.18.PM.mp4

@aaronrobertshaw aaronrobertshaw added [Type] Enhancement A suggestion for improvement. [Block] List Affects the List Block labels Jul 15, 2024
@aaronrobertshaw aaronrobertshaw self-assigned this Jul 15, 2024
Copy link

github-actions bot commented Jul 15, 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.

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

Co-authored-by: aaronrobertshaw <[email protected]>
Co-authored-by: andrewserong <[email protected]>

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

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one's testing well for me, too. When paired with a bunch of the other design tools, it allows for some fun styling now:

image

Similar to enabling border in the list block over in #63540, it made me wonder a tiny bit about nested list items, but overall I think it's working pretty well. Now that we can give list items a border, it's also made me wonder if it'd be worth allowing the list / list items to hide the item marker, since it's possible to use the border to visually indicate it now 🤔

I.e. a theme might style a list something like this:

image

In any case, now I'm just having fun styling lists 😄

LGTM! 🚀

@aaronrobertshaw
Copy link
Contributor Author

Thanks yet again for another thorough review @andrewserong 🙇

I'll hold off on this one for the moment while I explore follow-ups discussed on the PR adopting border support for the primary List block.

I like the idea of being able to change the list-style for lists. Along with perhaps adding that to the block itself, I wonder if making lists an element in theme.json/global styles would be beneficial.

@andrewserong
Copy link
Contributor

I like the idea of being able to change the list-style for lists. Along with perhaps adding that to the block itself, I wonder if making lists an element in theme.json/global styles would be beneficial.

It very well could be! If or when we explore that, it'd be worth reaching out to theme developers to see how valuable they might find it 🙂

@aaronrobertshaw aaronrobertshaw force-pushed the add/list-item-border-support branch from c775129 to 3d0d650 Compare August 9, 2024 13:28
@aaronrobertshaw
Copy link
Contributor Author

I've had a play with making global border styles only target the top-level list items. It seems to work as expected.

Screen.Recording.2024-08-09.at.8.25.18.PM.mp4

Should it be desirable in a theme to style inner list items as well, I think a block style variation as suggested on the related List block PR is a good option. A block style variation would also allow the inner list items to have different borders to the parent.

As with the parent List block, I'm leaning towards this latest approach as the most intuitive but I'd like to hear any thoughts on the matter.

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience @aaronrobertshaw, I missed your update from last week! This is looking good to me, and follows how I'd expect this to work as a user 👍

As with the #63540, I'm leaning towards this latest approach as the most intuitive but I'd like to hear any thoughts on the matter.

Me too, I think this makes for a nice feature in its current form. I also like that the selector being used is specific to border, so we're not affecting other styles that folks might be applying to the list item block.

✅ Setting borders for the list item in global styles now only applies to root list items
✅ Overriding at the individual block level works as expected
✅ Individual list items and nested list items can still use block-level styles for borders
✅ Tested in the site editor, site frontend, and post editors

image

LGTM! 🚀

@aaronrobertshaw
Copy link
Contributor Author

Thanks for your patience @aaronrobertshaw, I missed your update from last week!

I'm always happy to wait for your thorough reviews 🙂

Thanks for putting this through its paces again. Let's get it merged and see what creations users come up with!

@aaronrobertshaw aaronrobertshaw merged commit de65623 into trunk Aug 15, 2024
62 checks passed
@aaronrobertshaw aaronrobertshaw deleted the add/list-item-border-support branch August 15, 2024 03:18
@github-actions github-actions bot added this to the Gutenberg 19.1 milestone Aug 15, 2024
@artemiomorales artemiomorales added the [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi label Aug 23, 2024
@fabiankaegy fabiankaegy mentioned this pull request Oct 1, 2024
97 tasks
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 [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants