Skip to content

Consider allowing <hr> within list elements (ol, ul, menu)Β #9126

Open
@scottaohara

Description

I saw that #9124 was made today, and it reminded me that I had been wanting to file this issue for some time.

Late last year, I was working with developers who wanted to 'group' their list items, but did not want to include nested lists as they reasonably did not want to expose 3 nested lists within a larger list. Rather, as they were visually delineating the groupings of list items by a horizontal separator, they thought to use an hr element. But as that was not valid HTML, they then did <li role=separator>. But that role is also an invalid child of a list element, or element with role=list.

Their other option was to nest the hr within an li element, but that included it in the total count of list items, which was not their intent.

They finally settled on <li aria-hidden=true><hr></li> to mitigate the validation errors, and to ensure the separator did not contribute to the list item count total, but at the loss of exposing any separator semantics.

As HTML updated to allow div to group dt and dd elements, and per the mentioned PR #9124 to allow hr within select, it seems reasonable that ol, ul and menu elements should also allow hr as a way to separate li elements into 'groups'. There doesn't appear to be a parsing issue with this now, but as my testing (from oct 2022) shows, there are presently some inconsistencies with how AT handles the separator. But these inconsistencies could be ironed out if this was an allowed pattern, as opposed to the current behavior which is essentially mitigating author 'error'.

Metadata

Assignees

No one assigned

    Labels

    a11y-trackerGroup bringing to attention of a11y, or tracked by the a11y Group but not needing response.accessibilityAffects accessibilityaddition/proposalNew features or enhancementsdocument conformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions