Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pedrottimark
Copy link
Contributor

@pedrottimark pedrottimark commented Aug 6, 2024

Description

Apply 80/20 principle to fix generic issues so team members can divide and conquer pages that have specific issues.

Problem

Table header text should not be empty

https://dequeuniversity.com/rules/axe/4.9/empty-table-header

<th tabindex="-1" class="pf-v5-c-table__th"></th>

Analysis

Thank you David for observing <Th screenReaderText="Row expansion" /> in PatternFly example code that renders:

https://www.patternfly.org/components/table#expandable

<th><span className="pf-v5-screen-reader">{screenReaderText}</span></th>

patternfly/patternfly-react#10152

Until upgrade to PatternFly 5.3 in which Th element has screenReaderText prop, temporary solution is to render the span element as a child:

Here are the most common situations:

  • Row selection
  • Row expansion
  • Row actions

Solution

  1. Update selectors in integration tests for access control.
  2. Replace initial work-around Td in table head with Th element that has temporary child (pending future screenReaderText prop).
  3. Replace attempted work-around aria-label in Th element with temporary child (pending future screenReaderText prop).
  4. Add temporary child (pending future screenReaderText prop) to Th that does not have children, nor expand or select props (for which PatternFly renders children).
  5. Find occurrences to fix and prevent future problems via project-specific lint rules.
  6. Provide an easier pattern to follow for future accessibility rules.
    • Rename pluginAccessibility.js file more consistent with eslint-plugin-whatever package name and pluginWhatever name in eslint.config.js file.
    • Apply suggestion by Brad that recommended configuration removes need to change eslint.config.js file in the future.
    • Remove incorrect exceptions that prevented lint of pluginAccessibility.js file.
    • Remove jsx-a11y rules because its rules are based on HTML not PatternFly elements.

Residue

  1. Replace more occurrences with ExpandRowTh element?
  2. Remove eslint-plugin-jsx-a11y package from devDependencies after we replace yarn with npm.

User-facing documentation

  • CHANGELOG update is not needed
  • documentation PR is not needed

Testing and quality

  • the change is production ready: the change is GA or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

  1. yarn lint in ui
  2. yarn build in ui and then compute branch - master for the following
    • wc build/static/js/*.js
      main.js 0 = 4617863 - 4617863
      total 2114 = 11688528 - 11686414
    • ls -al build/static/js/*.js | wc
      files 0 = 174 - 174
  3. yarn start in ui

Manual testing

  1. Visit /main/listening-endpoints and see that expand prop of Th element renders a child.
    listening-endpoints_th_expand

  2. Visit /main/integrations/imageIntegrations/docker

    • Before changes, see td element at the right of table head.
      integrations_with_td

    • After changes, see th element at the right of table head.
      integrations_with_th

  3. Visit /main/access-control/permission-sets

    • Before changes, see th element with aria-label prop and presence of accessibility issue.
      permission-sets_with_issue

    • After changes, see th element with temporary span and absence of accessibility issue.
      permission-sets_without_issue

  4. Visit /main/access-control/roles?action=create

    • Before changes, see empty th element and presence of accessibility issue.
      roles_with_issue

    • After changes, see th element with temporary span and absence of accessibility issue.
      roles_without_issue

Integration testing

  • accessControl/accessControlAccessScopes.test.js
  • accessControl/accessControlAuthProviders.test.js
  • accessControl/accessControlOrigin.test.js
  • accessControl/accessControlPermissionSets.test.js
  • accessControl/accessControlRoles.test.js

@pedrottimark pedrottimark requested a review from a team as a code owner August 6, 2024 20:53
@rhacs-bot
Copy link
Contributor

rhacs-bot commented Aug 6, 2024

Images are ready for the commit at 291b0fc.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.6.x-273-g291b0fc6fb.

@codecov
Copy link

codecov bot commented Aug 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 48.26%. Comparing base (4a103b5) to head (291b0fc).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12300      +/-   ##
==========================================
- Coverage   48.26%   48.26%   -0.01%     
==========================================
  Files        2402     2402              
  Lines      171563   171563              
==========================================
- Hits        82809    82801       -8     
- Misses      82066    82073       +7     
- Partials     6688     6689       +1     
Flag Coverage Δ
go-unit-tests 48.26% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@dvail dvail left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you Mark!

@pedrottimark pedrottimark force-pushed the ROX-25632-accessibility-empty-th branch from 9fa8d05 to 291b0fc Compare August 9, 2024 13:33
@pedrottimark pedrottimark merged commit 043dd46 into master Aug 9, 2024
@pedrottimark pedrottimark deleted the ROX-25632-accessibility-empty-th branch August 9, 2024 15:52
shireenf-ibm pushed a commit to shireenf-ibm/stackrox that referenced this pull request Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants