patternfly / patternfly/patternfly-react

Bug - Table - hoverable example invalid markup and selection not announced on navigation

Open
#7,745 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A11y Stale
Dominant language
TypeScript
Stars
862
Forks
392
Avg merge
4d 8h
Merged PRs (30d)
9

Description

Describe the problem
Followup to #7732

The hoverable selectable Table example throws the following warning in the dev environment:

Warning: validateDOMNesting(...): <output> cannot appear as a child of <tbody>

Additionally, due to the way screen readers navigate tables (by cell rather than by row), the row that is selected only gets announced when a row is selected via a cell. Using Tab to navigate between rows (as the table caption instructs) does announce whether the row is selected, but it only announces the aria-label and not the content of the row.

Some possible alternatives:

  • Add a hidden input to each row, similar to the implementation seen in Data list selectable rows example. To avoid invalid markup, I believe this might require having an empty column similar to the table examples that use visible radio inputs.
  • Add a hidden input to the first cell of a row, and add styling so that when the radio input has focus it looks like the row has focus.
  • Move the current output element to the first <td> element of a row

How do you reproduce the problem?
Navigate the Hoverable selectable table example with a screen reader

Expected behavior
Markup is valid, and users can be notified whether the current row is selected as best as possible

Is this issue blocking you?
No

Screenshots
N/A

What is your environment?
N/A

What is your product and what release date are you targeting?
N/A

Any other information?
N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the hoverable selectable Table example linked in the issue and reproduce the warning and screen-reader behavior while navigating with a screen reader. Inspect the example's row-selection markup; done means the table has valid markup and announces whether the current row is selected as well as its content as far as possible.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
accessibility, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.