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
tyxla
left a comment
There was a problem hiding this comment.
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.
🚀 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
DropdownMenucomponent to rely oncodeinstead ofkeyCodefor keyboard events.Since some tests were failing because they were relying on
fireEvent, I went ahead and refactored them to usinguserEventand with "modern" RTL style (i.e. avoiding implementation details).Why?
keyCodeis deprecated, and replaced bycodeHow?
Easy swap of values
Testing Instructions
In Storybook, visit the
DropdownMenustory and make sure that the dropdown opens when focusing its toggle button and pressing the arrow down key.