ROX-25632: Fix accessibility issues for empty table header #12300
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Apply 80/20 principle to fix generic issues so team members can divide and conquer pages that have specific issues.
Problem
https://dequeuniversity.com/rules/axe/4.9/empty-table-header
Analysis
Thank you David for observing
<Th screenReaderText="Row expansion" />in PatternFly example code that renders:https://www.patternfly.org/components/table#expandable
patternfly/patternfly-react#10152
Until upgrade to PatternFly 5.3 in which
Thelement hasscreenReaderTextprop, temporary solution is to render thespanelement as a child:Here are the most common situations:
Solution
Tdin table head withThelement that has temporary child (pending futurescreenReaderTextprop).aria-labelinThelement with temporary child (pending futurescreenReaderTextprop).screenReaderTextprop) toThthat does not have children, norexpandorselectprops (for which PatternFly renders children).eslint-plugin-whateverpackage name andpluginWhatevername in eslint.config.js file.jsx-a11yrules because its rules are based on HTML not PatternFly elements.Residue
ExpandRowThelement?eslint-plugin-jsx-a11ypackage fromdevDependenciesafter we replace yarn with npm.User-facing documentation
Testing and quality
Automated testing
How I validated my change
yarn lintin uiyarn buildin ui and then compute branch - master for the followingwc build/static/js/*.jsmain.js 0 = 4617863 - 4617863
total 2114 = 11688528 - 11686414
ls -al build/static/js/*.js | wcfiles 0 = 174 - 174
yarn startin uiManual testing
Visit /main/listening-endpoints and see that

expandprop ofThelement renders a child.Visit /main/integrations/imageIntegrations/docker
Before changes, see

tdelement at the right of table head.After changes, see

thelement at the right of table head.Visit /main/access-control/permission-sets
Before changes, see

thelement witharia-labelprop and presence of accessibility issue.After changes, see

thelement with temporaryspanand absence of accessibility issue.Visit /main/access-control/roles?action=create
Before changes, see empty

thelement and presence of accessibility issue.After changes, see

thelement with temporaryspanand absence of accessibility issue.Integration testing