Problem/Motivation

The rendered comment tree does not meet WCAG 2.1 A in several respects, and a partial tree is worse than no tree. The tree is partial (10 of N roots, lazy branches) but does not expose set size or position, has no accessible name, and comments have no headings. Other issues: no skip link, duplicated announcements, an aria-label on a generic div, and errors announced politely rather than assertively.

Steps to reproduce

  • Open a thread with a screen reader.
  • Traverse the tree: note a group of 216 announces as "1 of 10" with no set size or position.
  • Attempt to bypass the comment block: no skip link exists.

Proposed resolution

  • Add aria-setsize and aria-posinset to treeitems.
  • Name the tree (role=tree) and each comment (role=heading or a heading element).
  • Add a skip link before the comment block.
  • Use role=alert for submission errors; avoid announcing to both Drupal.announce and the module's live region.
  • Replace the aria-label on the generic status div with a semantic role.
  • Do not point aria-describedby at the empty breadcrumb paragraph on root-level filter results, which currently leaves a dangling reference and adds dead vertical space per result.
  • Use :focus rather than :focus-visible on the programmatically focused tabindex=-1 landing targets (.act-comment-approval and [data-act-pending]); :focus-visible generally does not match script-focused non-natively-focusable elements, so focus currently moves with no visible indicator after approving a comment.

Remaining tasks

  • Verify with a screen reader and automated a11y checks.

User interface changes

Screen-reader-visible structure and announcements; no visual layout change.

API changes

None anticipated.

Data model changes

None anticipated.

AI-Generated: Yes (Used Opus 5 and DeepSeek Flash to review and discover these issues)

Comments

freelock created an issue. See original summary.

  • freelock committed a9b7dbb0 on 1.0.x
    test: #3623172 Simulate the JS-present state in the focus-ring spec
    

  • freelock committed f7e0114c on 1.0.x
    fix: #3623172 Accessibility of the comment tree
    

  • freelock committed d5467ef7 on 1.0.x
    fix: #3623172 Announce submission and reading state accessibly
    

  • freelock committed 8eff7332 on 1.0.x
    test: #3623172 Build the tree-contract fixture its assertions describe
    

  • freelock committed a2b1a942 on 1.0.x
    fix: #3623172 Defer skip-target ids to behavior attachment
    

  • freelock committed 9fda26bb on 1.0.x
    fix: #3623172 Keep filter result rows valid render arrays
    
freelock’s picture

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.