Skip to content

[css-overflow-5] Accessible semantics for :target-current #13537

@delucis

Description

@delucis

While evaluating the new :target-current pseudo-class, I wondered whether it should be reflected in the accessibility tree in some way.

I maintain a table of contents implementation using JS that in theory :target-current and scroll-target-group would be able to replace. Currently, we use aria-current="true" to highlight the current item in a table of contents. As far as I can tell (at time of writing, in Chrome 144), :target-current is not exposed with a similar “current item in group” semantics in the accessibility tree.

Should links matching :target-current receive some similar semantics in the AT?

I also saw Sara Soueidan discussing this, so want to link that too for reference: https://www.sarasoueidan.com/blog/css-scrollspy/#the-semantic-accessibility-of-html-scroll-markers

Because the purpose of the scroll-target-group property and the :target-current selector is to allow us to create JavaScript-free native HTML scroll markers, we should expect the browser to add and manage the necessary ARIA attribute(s) required for scroll markers to be inclusive. (After all, that’s the whole premise of this feature: to write a few lines of CSS and let the browser handle all the behavior for us.)

However, at the time of writing of this post, Chrome (currently the only browser that has implemented this feature) doesn’t add aria-current=true to the active anchor yet.


Originally posted in w3ctag/design-reviews#1037 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions