-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix(LEMS-2225): add conditional aria-describedby logic #2283
Conversation
🦋 Changeset detectedLatest commit: c156d96 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
npm Snapshot: Published🎉 Good news!! We've packaged up the latest commit from this PR (2db7d76) and published all packages with changesets to npm. You can install the packages in webapp by running: ./services/static/dev/tools/deploy_wonder_blocks.js --tag="PR2283" Packages can also be installed manually by running: yarn add @khanacademy/wonder-blocks-<package-name>@PR2283 |
Size Change: +885 B (+0.94%) Total Size: 95.3 kB
ℹ️ View Unchanged
|
A new build was pushed to Chromatic! 🚀https://5e1bf4b385e3fb0020b7073c-amwqizqlpx.chromatic.com/ Chromatic results:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2283 +/- ##
==========================================
+ Coverage 93.83% 95.13% +1.30%
==========================================
Files 252 253 +1
Lines 29825 30240 +415
Branches 2440 1869 -571
==========================================
+ Hits 27985 28770 +785
+ Misses 1793 1463 -330
+ Partials 47 7 -40
... and 47 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
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.
Just need to clean up one test file and a few comments and I think we're good to go! 🥳
@@ -87,6 +87,16 @@ const styles = StyleSheet.create({ | |||
flexDirection: "row", | |||
gap: spacing.medium_16, | |||
}, | |||
srOnly: { |
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.
nit: Does WonderBlocks have a utility constant for this? It would be great if it was in a shared file for other WonderBlocks components to use.
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.
It doesn't seem like it; I'd imagine since wonderblocks hosts components, they would all need to be visible
packages/wonder-blocks-popover/src/components/__tests__/popover.test.tsx
Outdated
Show resolved
Hide resolved
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.
Looks great to me! Just left a minor suggestion on refactoring one of the tests, but nothing blocking. Thanks for working on this improvement
await screen.findByRole("dialog", { | ||
description: "This is a popover description", |
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.
suggestion: With this refactor in place, I think it makes sense to create a separate test to assert the description
part of this test.
For some context, we try to follow the AAA approach for testing: https://khanacademy.atlassian.net/wiki/spaces/ENG/pages/98402353/JavaScript+Testing+Best+Practices#Assert-One-Requirement-Per-Test
https://khanacademy.atlassian.net/wiki/spaces/ENG/pages/98402353/JavaScript+Testing+Best+Practices#Assert-One-Requirement-Per-Test
One of the main benefits we have found by using this approach is that it's easier to isolate a failure when it happens and also easier to apply the fix when needed.
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.
Thanks Juan, I split it out into three tests that each have 1 assertion
Summary:
Adds conditional logic to allow aria-describedby to be:
aria-label
oraria-labelledby
Issue: LEMS-2225
Test plan:
yarn start
in branch or chromatic linkWith custom aria described by
storyScreenshots
Screen.Recording.2024-07-30.at.3.30.44.PM.mov