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

Removing wrapper div from the categories block #9798

Merged
merged 1 commit into from Sep 11, 2018

Conversation

Projects
None yet
4 participants
@kjellr
Contributor

kjellr commented Sep 11, 2018

Fixes #9411

Previously, the categories block was rendered inside a div, while other list-based blocks (archives, latest posts, list, etc.) were not. This update removes the div wrapper for consistency.

Previously, this block would render like this:

<!-- Categories Block -->
<div class="wp-block-categories wp-block-categories-list aligncenter">
  <ul>
    <li class="cat-item cat-item-1"><a href="#">Category</a></li>
    <li class="cat-item cat-item-2"><a href="#">Category</a></li>
    <li class="cat-item cat-item-3"><a href="#">Category</a></li>
  </ul>
</div>

But this change updates that to:

<!-- Categories Block -->
<ul class="wp-block-categories wp-block-categories-list aligncenter">
  <li class="cat-item cat-item-1"><a href="#">Category</a></li>
  <li class="cat-item cat-item-2"><a href="#">Category</a></li>
  <li class="cat-item cat-item-3"><a href="#">Category</a></li>
</ul>

We still need the wrapper div if this is shown as a dropdown, so this doesn't effect that. Seems like a simple change, and doesn't seem to require any css updates.

Removing wrapper div from the categories block
Previously, the categories block was rendered inside a div, while other list-based blocks (archives, latest posts, list, etc.) were not. This update removes the div wrapper for consistency.

@kjellr kjellr added the Blocks label Sep 11, 2018

@kjellr kjellr self-assigned this Sep 11, 2018

@kjellr kjellr requested review from mtias and WordPress/gutenberg-core Sep 11, 2018

@tofumatt

tofumatt approved these changes Sep 11, 2018 edited

Works for me. Technically it's a breaking change for anyone styling things if they happened to rely on it being a div, but that seems silly anyway 😄 . Dunno how we tend to handle that with markup, but the change itself looks good.

@ZebulanStanphill

This comment has been minimized.

Show comment
Hide comment
@ZebulanStanphill

ZebulanStanphill Sep 11, 2018

Contributor

While we're updating the Categories block markup, shouldn't it also use an <ol> instead of a <ul>? The categories are listed in an order, so an <ol> is more appropriate, is it not?

Contributor

ZebulanStanphill commented Sep 11, 2018

While we're updating the Categories block markup, shouldn't it also use an <ol> instead of a <ul>? The categories are listed in an order, so an <ol> is more appropriate, is it not?

@kjellr

This comment has been minimized.

Show comment
Hide comment
@kjellr

kjellr Sep 11, 2018

Contributor

Technically it's a breaking change for anyone styling things if they happened to rely on it being a div, but that seems silly anyway 😄 . Dunno how we tend to handle that with markup, but the change itself looks good.

Thanks, @tofumatt — I agree that this seems like it'd be a very small fraction of themes. If anything, I've mostly heard from theme authors who dislike that these are inconsistent. 😄 So I think we're good to go.

While we're updating the Categories block markup, shouldn't it also use an <ol> instead of a <ul>? The categories are listed in an order, so an <ol> is more appropriate, is it not?

@ZebulanStanphill: <ol> would render a numbered list, but I can't think of a reason for categories to be associated with a number. <ul> seems more appropriate to me in this case.

Contributor

kjellr commented Sep 11, 2018

Technically it's a breaking change for anyone styling things if they happened to rely on it being a div, but that seems silly anyway 😄 . Dunno how we tend to handle that with markup, but the change itself looks good.

Thanks, @tofumatt — I agree that this seems like it'd be a very small fraction of themes. If anything, I've mostly heard from theme authors who dislike that these are inconsistent. 😄 So I think we're good to go.

While we're updating the Categories block markup, shouldn't it also use an <ol> instead of a <ul>? The categories are listed in an order, so an <ol> is more appropriate, is it not?

@ZebulanStanphill: <ol> would render a numbered list, but I can't think of a reason for categories to be associated with a number. <ul> seems more appropriate to me in this case.

@kjellr kjellr added this to the 3.9 milestone Sep 11, 2018

@kjellr kjellr merged commit a0dfb14 into master Sep 11, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@kjellr kjellr deleted the update/categories-block-wrapper branch Sep 11, 2018

@ZebulanStanphill

This comment has been minimized.

Show comment
Hide comment
@ZebulanStanphill

ZebulanStanphill Sep 11, 2018

Contributor

@kjellr <ol> is not just for numbered lists. It is for any kind of ordered list. The Latest Comments block uses an <ol>, for example. You just have to style the <ol> to not show the numbers.

Contributor

ZebulanStanphill commented Sep 11, 2018

@kjellr <ol> is not just for numbered lists. It is for any kind of ordered list. The Latest Comments block uses an <ol>, for example. You just have to style the <ol> to not show the numbers.

@chrisvanpatten

This comment has been minimized.

Show comment
Hide comment
@chrisvanpatten

chrisvanpatten Sep 11, 2018

Contributor

@ZebulanStanphill I think the difference here is that if the order of the categories were to change, there would be no change in meaning. However, changing the order of comments would change the way they're interpreted, since comments may reply to each other or provide context as a discussion continues.

Per the spec:

The ol element represents a list of items, where the items have been intentionally ordered, such that changing the order would change the meaning of the document.

(Emphasis is mine)

Contributor

chrisvanpatten commented Sep 11, 2018

@ZebulanStanphill I think the difference here is that if the order of the categories were to change, there would be no change in meaning. However, changing the order of comments would change the way they're interpreted, since comments may reply to each other or provide context as a discussion continues.

Per the spec:

The ol element represents a list of items, where the items have been intentionally ordered, such that changing the order would change the meaning of the document.

(Emphasis is mine)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment