w3c / wcag

Web Content Accessibility Guidelines
https://w3c.github.io/wcag/guidelines/22/
Other
1.11k stars 252 forks source link

Modify G65 to support implementing current location in a breadcrumb trail as a link with `aria-current="page"` #3948

Closed mcking65 closed 1 month ago

mcking65 commented 3 months ago

The tests in G65: Providing a breadcrumb trail | WAI | W3C prohibit authors from implementing the current location in a breadcrumb trail as a link.

  1. For a breadcrumb trail that does include the current location:
    1. Check that all elements except for the current location are implemented as links.
    2. Check that the current location is not implemented as a link.

This is a proposal to change the G65 tests so the current location can optionally be represented by a link with aria-current="page" by revising the check as follows:

  1. For a breadcrumb trail that does include the current location:
    1. Check that all elements prior to the current location are implemented as links.
    2. Check that the current location is either not implemented as a link or is implemented as a link with aria-current="page".

The revised technique could also reference the ARIA Authoring Practices Guide for a supporting example.

Why?

  1. There are valid accessibility reasons for implementing the current location as a link.
  2. WCAG techniques are more valuable and robust when they avoid unnecessarily restricting design and facilitate maximum authoring flexibility.
  3. It would improve harmony among W3C WAI resources. G65, as explained below, makes the breadcrumb trail example in the ARIA Authoring Practices Guide appear invalid.

Rationale

The breadcrumb example in the ARIA Authoring Practices Guide implements the current location as a link.

The APG task force recently became aware of this difference between the APG and WCAG technique when the task force received this issue -- Should the current location on a breadcrumb trail be an anchor element? · Issue #3047 · w3c/aria-practices

The APG task force chose to use a link for current location because:

  1. The markup clearly communicates the current location in the navigation using aria-current.
  2. The design makes current location perceivable when tabbing or reading a list of links.

If the current location is plain text, the meaning of the text depends entirely on the surrounding context. While that is not an unreasonable dependency, it is an unnecessary dependency for the breadcrumb pattern because the dependency can be removed by using a link with aria-current instead of plain text.

patrickhlauke commented 3 months ago

The thing with techniques is though: not following the technique does not mean an authors necessarily fails the SC. Techniques are but one way of passing an SC. They're not comprehensive or complete, so the current G65 does not preclude authors from actually using aria-current and having the current page as a link.

So sure, G65 could be expanded to also show an example of this different approach (as both are valid for the purposes of the SC). Or a new technique could be created purely for the variant with link and aria-current.

scottaohara commented 3 months ago

seems G65 could just be modified a bit to allude to the fact that either are ok.

fstrr commented 3 months ago

That reminds me that I wrote a technique for aria-current in 2021.