-
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
[$500] Web - After using the Enter key in any field, the 'Upload Photo' feature becomes visible on another #31756
Comments
Job added to Upwork: https://www.upwork.com/jobs/~01faa982f8264324b6 |
Triggered auto assignment to @zanyrenney ( |
Bug0 Triage Checklist (Main S/O)
|
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Santhosh-Sellavel ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Upload Photo popover is still visible when clicking Enter on other field. What is the root cause of that problem?When user presses Enter outside of the PopoverMenu, it simply doing nothing instead of closing it. App/src/components/PopoverMenu/index.js Lines 68 to 70 in 14abfa1
What changes do you think we should make in order to solve the problem?We should close the popover if user presses Enter outside of the popover. if (focusedIndex === -1) {
props.onClose();
return;
} What alternative solutions did you explore? (Optional)N/A |
I was able to reproduce the issue on Web (Chrome / Safari / Firefox) and Desktop -> all platforms where the user can navigate using keyboard TAB key. ProposalPlease re-state the problem that we are trying to solve in this issueAfter opening Avatar's popover menu 'Upload Photo' via keyboard Enter key, the popover remains opened after navigating away from Avatar to other fields via keyboard TAB key, the popover persisting even when navigating to one of the other fields pages like What is the root cause of that problem?This is happening because the What changes do you think we should make in order to solve the problem?My solution for this is to writa a useEffect with
from useEffect - Code implementation
What's different in my proposal is that it closes the popover menu as soon as the TAB key is pressed and the focus is set to the next / previous item from the Avatar (popover origin), instead of closing the popup only when navigating to another section like Video of first proposal's solution (for reference)Screen.Recording.2023-11-23.at.03.44.35.movVideosMacOS: Chrome - Current proposal's solutionScreen.Recording.2023-11-23.at.03.40.07.mov |
ProposalPlease re-state the problem that we are trying to solve in this issue.After using the Enter key in any field, the 'Upload Photo' feature becomes visible on another page What is the root cause of that problem?Normally the PopoverMenu will be closed if there's a click outside, but in case we navigate to another page using tab and then clicking Enter, it will not trigger any click so the PopoverMenu will stay. What changes do you think we should make in order to solve the problem?When we see an Enter event coming when the Popover is visible here, if there's no menu item currently focused, and the anchor is also not focused, we'll close the PopoverMenu
We can also optionally make sure We need to check that the anchor is not currently focused before calling What alternative solutions did you explore? (Optional)We can add |
ProposalPlease re-state the problem that we are trying to solve in this issue.Navigating to another page with keyboard won't close a visible popover. What is the root cause of that problem?We don't have a logic to handle such case. What we have is a logic to close the popover when a click happens outside of the menu. App/src/components/PopoverProvider/index.tsx Lines 28 to 41 in 4952c39
What changes do you think we should make in order to solve the problem?We have a logic to close the popover when a click happens outside of the menu, so I think it makes sense if also we add a logic to close the popover when a "click" with an ENTER key happens outside of the menu. To do that, we can listen to
The ENTER "click" is only triggered when we lift the key, so we use keyup here which will be consistent with click What alternative solutions did you explore? (Optional)Before having our own popover code, we use a modal to show the popover. A modal in rn-web by default has a focus trap, so it's impossible to use a TAB key to "click" other button/pressable outside of the menu with an ENTER key. If we add a focus trap to our popover, then this issue won't happen. the recent focus trap PR is reverted, so if we want to use this solution, we should wait for the new PR |
@Santhosh-Sellavel please can you review the propsoals? |
I'll let CME make a final decision @bernhardoj's seems like a better solution between the two (1 & 4) C+ Reviewed |
Triggered auto assignment to @thienlnam, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
There was another PR I came across recently that addresses a similar issue with focus trapping in the RHP #27670 It had to get reverted but it seems like it might also resolve this issue - do you agree @Santhosh-Sellavel? If so I'll put this on hold for that issue |
@Santhosh-Sellavel can you explain more on why you think the 4th solution is better? It adds another listener which is overhead, while my proposal uses an exising listener. It’s also more complex and doesn’t use the recommended method of listening to key events. |
@dukenv0307 no idea why I was tagged here |
@0xmiroslav sorry I meant to tag @Santhosh-Sellavel 🙏 updated comment |
@thienlnam, @zanyrenney, @Santhosh-Sellavel Whoops! This issue is 2 days overdue. Let's get this updated quick! |
bump @Santhosh-Sellavel what are your thoughts on what @thienlnam said above here |
@thienlnam Sorry I didn't post a reply earlier, yes we can hold this for that as it seems it might resolve this one too! |
thanks for the update @thienlnam |
please can you link the other issue that we are holding this on though? |
Still on hold |
I'm unavailable next week, Please assign a new C+ Issue here if required while I am away, thanks! cc: @zanyrenney |
Back now |
No worries @Santhosh-Sellavel |
Stillon HOLD. |
@thienlnam I have been sifting through the projects but I am actually not 100% sure which one this would fit in. DO you have any ideas? Would appreciate a second opinion! I was thinking maybe performance? |
I would probably categorize under vip-vsb as part of general improvements related to the individual user experience |
okay fab, thank you for taking a look! |
I believe this is still on hold @thienlnam let me know if you disagree. |
Holding PR is complete, we should retest to see if this is still reproducible |
The previous focus trap PR was closed, so it's not completed yet. Here is the new focus trap PR. |
The focus trap PR is done. I can't repro it anymore. |
Great, thanks - going to close |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: 1.4.2.0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
Action Performed:
Expected Result:
After using the Enter key in any field, the 'Upload Photo' feature should not be visible on another page
Actual Result:
After using the Enter key in any field, the 'Upload Photo' feature becomes visible on another page
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6287724_1700685497820.Recording__5501.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: