-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
feat: arrow navigation in context menu #27877
Conversation
For mobile, where there's no arrows, I have added to the test steps to verify that the context menu opens as expected when long-pressing. Let me know if you think I should change it. |
src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js
Outdated
Show resolved
Hide resolved
src/pages/home/report/ContextMenu/BaseReportActionContextMenu.js
Outdated
Show resolved
Hide resolved
Co-authored-by: Situ Chandra Shil <[email protected]>
Co-authored-by: Situ Chandra Shil <[email protected]>
Thank you, I have accepted both suggestions. |
Also, please pull main |
unit test failing Also, found the case of arrows not working on LHN context menu while focusing on composer Screen.Recording.2023-09-21.at.7.17.56.PM.mov |
We prevent losing composer focus when clicking on an LHN item (here). I think we need to have a similar handling as in EmojiReactionBubble (here) and check if |
I was about to say it's out of scope. There's already GH to blur composer when any popover is open - #25485 |
Please investigate why unit test is failing |
Good find, perhaps then it is better to leave it for that issue as they are taking a broader approach which would make my solution redundant. |
recheck |
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.
triggering actions
@samh-nl please revert full code and see it still happens |
I see this particular unit test is also failing in another recent PR: https://github.com/Expensify/App/actions/runs/6261808769/job/17002648235?pr=27941 |
Could revert, but if you check the accepted suggestions: one of them caused the error, the other one didn't, so it's a bit random (it measures execution time). If the error doesn't occur after reverting, it might just be luck. |
yes, let's try. Hope that "luck" won't happen |
pass. now re-revert |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - ChromeMobile Web - Safarimsafari.movDesktopdesktop.moviOSios.movAndroid |
Another weird behavior: Screen.Recording.2023-09-21.at.9.25.06.PM.movEnter key triggers 2 actions at the same time |
Also occurs when right-clicking an avatar. Focus is put on the element. Let me check how to solve this, shouldPreventDefault is already default true. |
Here's my solution: The shouldPreventDefault is not enough, what it needs is And then in our usage of |
I see in the callback we pass the event, so instead of adding a new config, what also works is to add it like this: useKeyboardShortcut(
CONST.KEYBOARD_SHORTCUTS.ENTER,
- () => {
+ (event) => {
+ // Ensures the event does not cause side-effects beyond the context menu, e.g. when an outside element is focused
+ event.stopPropagation(); |
ok, that looks good. Thanks for the research |
I have pushed the change |
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.
@francoisl all yours
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, minor small change request
src/components/ContextMenuItem.js
Outdated
@@ -89,6 +99,7 @@ function ContextMenuItem({onPress, successIcon, successText, icon, text, isMini, | |||
descriptionTextStyle={styles.breakAll} | |||
style={getContextMenuItemStyles(windowWidth)} | |||
isAnonymousAction={isAnonymousAction} | |||
focused={focused} |
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.
I also thought isFocused
name is better but didn't request change because focused
prop name already exists here 😄
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.
I have adjusted the prop name in the added code.
If you'd like me to refactor the existing prop in MenuItem and change it there + it's usages also, let me know.
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.
I think that's fine as we didn't touch MenuItem
component here.
If anyone is adding/changing props on that component in the future, they might be responsible.
cc: @francoisl
Co-authored-by: Francois Laithier <[email protected]>
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.
👍
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
There's 2 hrs delay from bonus timeline but it would be much appreciated if it's still eligible unless any regression found. |
🚀 Deployed to staging by https://github.com/francoisl in version: 1.3.73-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.73-1 🚀
|
🚀 Deployed to staging by https://github.com/francoisl in version: 1.3.74-0 🚀
|
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.74-3 🚀
|
Details
Navigating the report actions context menu with arrows was not previously possible.
Fixed Issues
$ #23280
PROPOSAL: #23280 (comment)
Tests
Web/desktop
Mobile
Offline tests
Web/desktop
Mobile
QA Steps
Web/desktop
Mobile
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Web.Screen.Recording.2023-09-20.at.18.26.03.mov
Mobile Web - Chrome
mWeb.Chrome.webm
Mobile Web - Safari
mWeb.Safari.screencap-2023-09-20T165102.236Z.mp4
Desktop
Desktop.Screen.Recording.2023-09-20.at.18.27.06.mov
iOS
Native.iOS.screencap-2023-09-20T165350.509Z.mp4
Android
Native.Android.webm