You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2023-09-21] [$1000] dev: ESC keyboard shortcut shows up in modal on second render on login page #25448
now close the modal and observe content while it closes
now open it again
Expected Result:
ESC shortcut should always be shown in the modal
Actual Result:
ESC shortcut is visible for a brief moment while shortcut modal closes, later it is shown consistently
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Android / native
Android / Chrome
iOS / native
iOS / Safari
MacOS / Chrome / Safari
MacOS / Desktop
Version Number: v1.3.55-7 Reproducible in staging?: Yes Reproducible in production?: Yes 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 Notes/Photos/Videos: Any additional supporting documentation
Please re-state the problem that we are trying to solve in this issue.
ESC keyboard shortcut shows up in modal on second render on login page
What is the root cause of that problem?
Root cause of this issue is as follows:
We add shortcuts to the modal via documentedShortcuts object and a shortcut gets added to it only when that shortcut is subscribed here in subscribe function
// Allow closing the modal with the both Enter and Escape keys
// Both callbacks have the lowest priority (0) to ensure that they are called before any other callbacks
// and configured so that event propagation is stopped after the callback is called (only when the modal is open)
subscribedOpenModalShortcuts.current=[
KeyboardShortcut.subscribe(
closeShortcutEscapeModalConfig.shortcutKey,
And from when the page loads till the point we open the modal once using CMD+J, this piece of code never executes because isShortcutsModalOpen remains false till that point
Thus the ESC shortcut is never subscribed until we open the modal once on login screen, unlike other places
Now once you open the modal, it gets subscribed, and now when you close it, you get to see the ESC shortcut for a brief moment and after that, we see it whenever we open the modal
What changes do you think we should make in order to solve the problem?
We need to subscribe to openmodal shortcuts without any condition on modal mounting which essentially means the following changes:
When the components load (initial), we call the function KeyboardShortcut.getDocumentedShortcuts() and store the result in the constant variable shortcuts. In useEffect we are callingsubscribeOpenModalShortcuts() subscribe function but fail to handle any changes in the shortcuts variable. Based on changes we are not rendering it.
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.69-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-09-21. 🎊
After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
External issue reporter
Contributor that fixed the issue
Contributor+ that helped on the issue and/or PR
For reference, here are some details about the assignees on this issue:
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
[@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
[@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
[@mollfpr] Determine if we should create a regression test for this bug.
[@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
[@Christinadobrzyn] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
[@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
[@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
I couldn't make sure if there's a PR causing the regression. The implementation was already there years ago, and a lot of changes on our keyboard shortcut handle.
[@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
The regression step should be enough.
[@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
Sign out from the app
Refresh the page (for iOS and Android you need to close and reopen the app)
Press cmd+j to open the shortcut modal (testing on iOS and Android required to use physical keyboard)
Activity
melvin-bot commentedon Aug 17, 2023
Triggered auto assignment to @conorpendergrast (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Aug 17, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)kavimuru commentedon Aug 17, 2023
Proposal by @chiragxarora
Please re-state the problem that we are trying to solve in this issue.
ESC keyboard shortcut shows up in modal on second render on login page
What is the root cause of that problem?
Root cause of this issue is as follows:
We add shortcuts to the modal via
documentedShortcutsobject and a shortcut gets added to it only when that shortcut is subscribed here in subscribe functionApp/src/libs/KeyboardShortcut/index.js
Lines 135 to 142 in fdcae9f
Now coming to the modal, we are subscribing to the ESC shortcut inside
subscribeOpenModalShortcutsfunction hereApp/src/components/KeyboardShortcutsModal.js
Lines 49 to 56 in fdcae9f
And from when the page loads till the point we open the modal once using CMD+J, this piece of code never executes because
isShortcutsModalOpenremains false till that pointApp/src/components/KeyboardShortcutsModal.js
Lines 128 to 131 in fdcae9f
same case with second useEffect, where it always lands in the else object
App/src/components/KeyboardShortcutsModal.js
Lines 143 to 152 in fdcae9f
Thus the ESC shortcut is never subscribed until we open the modal once on login screen, unlike other places
Now once you open the modal, it gets subscribed, and now when you close it, you get to see the ESC shortcut for a brief moment and after that, we see it whenever we open the modal
What changes do you think we should make in order to solve the problem?
We need to subscribe to openmodal shortcuts without any condition on modal mounting which essentially means the following changes:
replacing this
App/src/components/KeyboardShortcutsModal.js
Lines 128 to 131 in fdcae9f
with this
Results
What alternative solutions did you explore? (Optional)
None
Charan-hs commentedon Aug 18, 2023
chiragxarora commentedon Aug 18, 2023
Charan-hs commentedon Aug 18, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
ESC keyboard shortcut shows up in modal on second render on login page
What is the root cause of that problem?
App/src/components/KeyboardShortcutsModal.js
Line 44 in fdcae9f
When the components load (initial), we call the function
KeyboardShortcut.getDocumentedShortcuts()and store the result in the constant variableshortcuts. InuseEffectwe are callingsubscribeOpenModalShortcuts()subscribe function but fail to handle any changes in theshortcutsvariable. Based on changes we are not rendering it.For this #25448 (comment) cause is
App/src/libs/KeyboardShortcut/index.js
Lines 83 to 87 in fdcae9f
When unsubscribing, we remove event listeners but not shortcuts from the variable
documentedShortcuts.What changes do you think we should make in order to solve the problem?
App/src/components/KeyboardShortcutsModal.js
Line 44 in fdcae9f
we can handle
shortcutsvariable withUseStatefunction so it will take care the onChanges render issue.In these two places call
SetStateFunction along withsubscribeOpenModalShortcuts()App/src/components/KeyboardShortcutsModal.js
Lines 143 to 146 in fdcae9f
App/src/components/KeyboardShortcutsModal.js
Lines 127 to 131 in fdcae9f
We are setting the state when the modal is opened, Once the component unmounts reset the state.
bug.resolved.shortcut.mp4
Charan-hs commentedon Aug 18, 2023
chiragxarora commentedon Aug 18, 2023
Charan-hs commentedon Aug 18, 2023
melvin-bot commentedon Aug 21, 2023
@conorpendergrast Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
85 remaining items
melvin-bot commentedon Sep 14, 2023
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Sep 14, 2023
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.69-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2023-09-21. 🎊
After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.
For reference, here are some details about the assignees on this issue:
As a reminder, here are the bonuses/penalties that should be applied for any External issue:
melvin-bot commentedon Sep 14, 2023
BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
Christinadobrzyn commentedon Sep 15, 2023
prepping for payment...
Christinadobrzyn commentedon Sep 15, 2023
Just bringing up this comment
The speed bonus timeline might need to be reevaluated.
So I think the bonus would actually apply here? @arosiclair @mollfpr?
chiragxarora commentedon Sep 16, 2023
@Christinadobrzyn pls send offer, I don't have connects
arosiclair commentedon Sep 16, 2023
Yeah that makes sense to me. There's no hard rule but here's a thread where we talked about it.
mollfpr commentedon Sep 19, 2023
I couldn't make sure if there's a PR causing the regression. The implementation was already there years ago, and a lot of changes on our keyboard shortcut handle.
The regression step should be enough.
Christinadobrzyn commentedon Sep 19, 2023
@chiragxarora I sent an Upwork invitation to you - here's the job posting - https://www.upwork.com/jobs/~01a6b0de738da985ac
chiragxarora commentedon Sep 20, 2023
Accepted! @Christinadobrzyn
mollfpr commentedon Sep 22, 2023
Friendly bump @Christinadobrzyn
Christinadobrzyn commentedon Sep 22, 2023
Regression test: https://github.com/Expensify/Expensify/issues/319173
This issue was created before Aug 30th so we'll adhere to the old payment scale
Payouts due:
Issue Reporter: $250 @chiragxarora
Contributor: $1000 + 500 speed bonus @Charan-hs
Contributor+: $1000 + 500 speed bonus @mollfpr
Eligible for 50% #urgency bonus? Y - #25448 (comment)
Upwork job is here.
Paid! Thanks for all your help!