-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
DropdownMenu: use KeyboardEvent.code, refactor tests to model RTL and user-event #43439
Conversation
Size Change: +2 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
2171b5b
to
c68d805
Compare
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 good 👍 Needs a rebase, otherwise ready to ship IMO 🚀
👋🏻 @ciampo. I would be happy to review/test — it is on my todo list — but I made need a couple of days before I can dedicate time to this. I went ahead and triggered additional mobile CI tests. |
That's great to hear! I'll wait for your review, then (this is not a high-priority PR anyway, so no need to rush!) |
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. I left one comment for context, but it is not a blocker.
I tested the Heading level, Alignment (horizontal and vertical), and Justification dropdown menus on an iPhone SE and Samsung Galaxy S20. I believe those are the only locations leveraging DropdownMenu
currently.
Thank you for pinging the native team. 🙇🏻
bf22040
to
f461f65
Compare
Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com>
67b3812
to
79c31db
Compare
What?
Refactor the
DropdownMenu
component to rely oncode
instead ofkeyCode
for keyboard events.Since some tests were failing because they were relying on
fireEvent
, I went ahead and refactored them to usinguserEvent
and with "modern" RTL style (i.e. avoiding implementation details).Why?
keyCode
is deprecated, and replaced bycode
How?
Easy swap of values
Testing Instructions
In Storybook, visit the
DropdownMenu
story and make sure that the dropdown opens when focusing its toggle button and pressing the arrow down key.