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

role="separator" is not a valid list child #829

Open
angelikatyborska opened this issue Aug 19, 2024 · 1 comment
Open

role="separator" is not a valid list child #829

angelikatyborska opened this issue Aug 19, 2024 · 1 comment

Comments

@angelikatyborska
Copy link
Contributor

angelikatyborska commented Aug 19, 2024

Elements with role separator are not valid children of lists (ul, ol).

I found this issue while working on #414:

    Expected the HTML found at $('.u-list-none:nth-child(2)') to have no violations:
    <ul class="u-list-none">

    Received:
    <ul> and <ol> must only directly contain <li>, <script> or <template> elements (list)

    Fix all of the following:
      List element has direct children that are not allowed: [role=separator]

    You can find more information on this issue here:
    https://dequeuniversity.com/rules/axe/4.10/list?application=axeAPI

I saw that the documentation recommends adding <li role="separator"></li> as list children in dropdown menus. See screenshot:

Screenshot 2024-08-19 at 13-25-01 Atoms _ Dropdown _ Overview - Page ⋅ Storybook

I believe the semantically correct way of providing a visual separator between list elements would be to split content into two separate lists and style them accordingly, for example:

<div class="list-group">
  <ul>
    <li>..</li>
  </ul>
  <ul>
    <li>..</li>
  </ul>
</div>
.list-group *:is(ul, ol):not(:last-child)::after {
  // add some whitespace and a visual line
}
@planktonic
Copy link
Member

Yes, we’d need to update in a few places:

  • update the documentation for this component
  • fix the HTML examples we give. They are currently not componentized, so we have static HTML repeated, we’d need to update them all
  • Update styling to apply the spacing & border currently applied to the separator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants