-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[A11y] Render aria-label
as text in the icon testenv file
#5709
Conversation
aria-label
as text in the icon testenv file
Preview documentation changes for this PR: https://eui.elastic.co/pr_5709/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Cool solution for this test mock (rendering the label as text)!
Re: CI failures - it looks like you'll want to run |
Thanks a lot for the review, @constancecchen! And for the snaphots update tip 🎉 |
Preview documentation changes for this PR: https://eui.elastic.co/pr_5709/ |
…ing for strict text equality to account for text coming from the EuiScreenReaderOnly component. Also updated tests to account for EuiIcon text that is now rendered when the icon is imported from .testenv (PR 5709 - elastic/eui#5709).
@yuliacech What's the axe violation this was solving? |
This is the error:
So one very easy alternative (if this is causing too much downstream Kibana snapshot churn) to this PR would be to add |
That seems like a better solution. The real component would render |
@thompsongl @constancecchen Yes, the violation was about having an |
Thanks, @yuliacech This is less immediate now, but I'm going to plan on exploring the |
* Updgraded EUI packages in package.json and src/dev/license_checker/config.js * Resolved Jest test failures for Jest test suites 1 and 2. Updated snapshots, and updated equality conditions for specific test cases * Resolve Jest test cases for Jest test suite 3. Updated snapshots for required tests * type fixes * Resolved failing Jest test cases in Jest suite 3. Updated tests checking for strict text equality to account for text coming from the EuiScreenReaderOnly component. Also updated tests to account for EuiIcon text that is now rendered when the icon is imported from .testenv (PR 5709 - elastic/eui#5709). * eui to 52.2.0 * Resolved test cases for Jest test suites 1 and 2. Updated required snapshots. Updated tests using getAllByLabelText and getByLabelText to getAllByText and getByText respectively as the former have been deprecated * Updated Jest tests for Jest test suites 5 and 6. Updated required snapshots. Updated instances of getByLabelText and getAllByLabelText to getByText and getAllByText as the former are now deprecated. * Updated Jest tests for Jest test suite 7. Updated required snapshots. * Completed test case revisions for Jest test suites 1, 3, 6, 7, and 8. Updated required snapshots. Updated various tests to account for text rendering of the EuiIcon text. * eui back to v52.2.0 * removed unused test utils * use .contains for euiicon content * storyshots updates * linting Co-authored-by: Greg Thompson <[email protected]>
…ing for strict text equality to account for text coming from the EuiScreenReaderOnly component. Also updated tests to account for EuiIcon text that is now rendered when the icon is imported from .testenv (PR 5709 - elastic/eui#5709).
Mentioning for recordkeeping, another example in Kibana of unintentional Jest churn based on tests looking for text content: elastic/kibana@d9fc2a1 - the test failed because it was looking for 1 instance of the passed text in the document and received 2 instead. We should revert the above commit if we also decide to revert this and use |
* Updgraded EUI packages in package.json and src/dev/license_checker/config.js * Resolved Jest test failures for Jest test suites 1 and 2. Updated snapshots, and updated equality conditions for specific test cases * Resolve Jest test cases for Jest test suite 3. Updated snapshots for required tests * Resolved failing Jest test cases in Jest suite 3. Updated tests checking for strict text equality to account for text coming from the EuiScreenReaderOnly component. Also updated tests to account for EuiIcon text that is now rendered when the icon is imported from .testenv (PR 5709 - elastic/eui#5709). * type fixes * eui to 52.2.0 * Resolved test cases for Jest test suites 1 and 2. Updated required snapshots. Updated tests using getAllByLabelText and getByLabelText to getAllByText and getByText respectively as the former have been deprecated * Updated Jest tests for Jest test suites 5 and 6. Updated required snapshots. Updated instances of getByLabelText and getAllByLabelText to getByText and getAllByText as the former are now deprecated. * Updated Jest tests for Jest test suite 7. Updated required snapshots. * Completed test case revisions for Jest test suites 1, 3, 6, 7, and 8. Updated required snapshots. Updated various tests to account for text rendering of the EuiIcon text. * removed unused test utils * use .contains for euiicon content * storyshots updates * linting * Fix failing a11y violations tests * Fix Jest failures caused by #eui/5709 - these changes should be reverted if we opt to revert the above PR Co-authored-by: Bree Hall <[email protected]> Co-authored-by: Greg Thompson <[email protected]>
Summary
Similar to #5702 , this PR updates the
testenv
file for EuiIcon that renders a mock version of EuiIcon. The current mock attachesaria-label
as attribute to a span element that is rendered instead of an icon. This causes a11y violations in Kibana (see elastic/kibana#127185). I'm suggesting renderingaria-label
as text if present.Checklist
I don't think any of the items in the checklist are applicable because this PR only touches the mock file.
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Checked in mobile- [ ] Checked in Chrome, Safari, Edge, and Firefox- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for any docs examples- [ ] Added or updated jest and cypress tests- [ ] Checked for breaking changes and labeled appropriately- [ ] Checked for accessibility including keyboard-only and screenreader modes