-
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
WB-1638.1: Fix clickable behavior on IconButton #2131
Conversation
🦋 Changeset detectedLatest commit: 63261f0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
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 |
Size Change: +148 B (0%) Total Size: 90.9 kB
ℹ️ View Unchanged
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #2131 +/- ##
=======================================
Coverage 97.04% 97.05%
=======================================
Files 241 241
Lines 27995 28038 +43
Branches 2459 2381 -78
=======================================
+ Hits 27169 27212 +43
Misses 826 826
Continue to review full report in Codecov by Sentry.
|
npm Snapshot: Published🎉 Good news!! We've packaged up the latest commit from this PR (08f74b1) 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="PR2131" Packages can also be installed manually by running: yarn add @khanacademy/wonder-blocks-<package-name>@PR2131 |
A new build was pushed to Chromatic! 🚀https://5e1bf4b385e3fb0020b7073c-hpzxfmqbch.chromatic.com/ Chromatic results:
|
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.
Ahh - great! Thanks for the tests, as well.
Summary:
First part in a series of fixes to Popover.
I recently removed
ClickableBehavior
fromIconButton
because some APIs haveimproved in the last years making it easier to implement the same behavior
without the need of
ClickableBehavior
.Turns out that I missed a few things, and this PR fixes them:
Adds keyboard handlers to
IconButton
so that the click event can betriggered the same way with
Enter
andSpace
keys. By not doing this, it was causing that the Popover was being immediately re-opened if the user pressedEnter
on the close button.Prevents the button from displaying the pressed state after the user has
pressed the button with a mobile device (sticky active state).
Issue: WB-1638
Test plan:
1. Normalized
Enter
andSpace
behavior:In desktop, verify that the button can be pressed with
Enter
andSpace
keysand that in both cases the button triggers the
onClick
callback only on key up.Verify that a Popover is not immediately re-opened if the user presses
Enter
on the close button.BEFORE
icon-button-enter-before.mov
AFTER
icon-button-enter-after.mov
2. Prevent sticky active state on mobile devices:
In mobile, verify that the button doesn't display the pressed state after the
user has pressed the button.
BEFORE
icon-button-sticky-pressed-before.MP4
AFTER
icon-button-sticky-pressed-after.MP4