Closed lanitochka17 closed 4 months ago
Triggered auto assignment to @mallenexpensify (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details.
Job added to Upwork: https://www.upwork.com/jobs/~0123ed583fdc5774f0
Platforms
in OP are ✅)Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External
)
App focuses back on composer when we open actions popup and open any right click popup in LHN
When popover is closed, onPopoverMenuClose
is called.
https://github.com/Expensify/App/blob/d6755d68444d5d8e9e2c7593c7eb3f1228a20c67/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js#L166
And then restoreKeyboardState
is called which makes the composer focused.
https://github.com/Expensify/App/blob/d6755d68444d5d8e9e2c7593c7eb3f1228a20c67/src/pages/home/report/ReportActionCompose/ReportActionCompose.js#L193
We already the logic here to blur the active element but the time this function is called, the active element isn't composer. https://github.com/Expensify/App/blob/8fa65ec4de74f22f7c700eb78b4ee83eda96de58/src/components/LHNOptionsList/OptionRowLHN.js#L195
We should pass event
to onPopoverMenuClose
and pass it to onMenuClosed
. And then in restoreKeyboardState
, we should check if the event.target
is a clickable element, we will not focus the composer.
We can add InteractionManager.runAfterInteractions
here to wait the composer focus and then blur it.
The composer is focused if we close the add action popover by opening another popover.
Every time the add action popover closes, we call restoreKeyboardState
which will refocus the keyboard.
https://github.com/Expensify/App/blob/d6755d68444d5d8e9e2c7593c7eb3f1228a20c67/src/pages/home/report/ReportActionCompose/ReportActionCompose.js#L193-L199
When we right-click the LHN item or chat report message, it will:
The composer focus will call focusComposerWithDelay
https://github.com/Expensify/App/blob/d6755d68444d5d8e9e2c7593c7eb3f1228a20c67/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js#L399-L401
In focusComposerWithDelay
, we already have a logic to prevent the focus from happening if the emoji picker is visible. That's why this doesn't happen when we open the emoji picker and then open the report popover.
https://github.com/Expensify/App/blob/d6755d68444d5d8e9e2c7593c7eb3f1228a20c67/src/libs/focusComposerWithDelay.ts#L14-L19
Don't focus if the report/LHN popover is visible. Both use the same component, PopoverReportActionContextMenu.
PopoverReportActionContextMenu
called isVisible
https://github.com/Expensify/App/blob/d6755d68444d5d8e9e2c7593c7eb3f1228a20c67/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js#L272-L282
isVisible: isPopoverVisible
focusComposerWithDelay
, early return if PopoverReportActionContextMenu.isVisible()
is true.
import * as ReportActionContextMenu from '@pages/home/report/ContextMenu/ReportActionContextMenu';
if (!textInput || EmojiPickerAction.isEmojiPickerVisible() || ReportActionContextMenu.isVisible()) { return; }
### What alternative solutions did you explore? (Optional)
I notice that this also happens if we:
1. Open add action (+) popover
2. Press the three-dots menu
3. The composer will be focused
To solve this for all popover, we can prevent the focus if any of the popover is showing.
To do that, in ComposerWithSuggestions, get the popover context visible state.
const {isOpen} = React.useContext(PopoverContext);
const focus = useCallback((shouldDelay = false) => { if (isOpen) { return; }
I liked @bernhardoj's proposal to fix this with ComposerWithSuggestions
's popover context visible state.
🎀 👀 🎀 C+ reviewed
Triggered auto assignment to @jasperhuangg, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@jasperhuangg when you have a min can you review @bernhardoj 's proposal above? https://github.com/Expensify/App/issues/32970#issuecomment-1854133465
📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑💻 Keep in mind: Code of Conduct | Contributing 📖
Sorry for the delay, NewDot deployer chore has taken a lot of time this week. Looks good to me, assigned!
PR is ready
cc: @mananjadhav
Reviewing
label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 1.4.21-4 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2024-01-11. :confetti_ball:
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:
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:
@mananjadhav hi, we have a regression here. The issue is that the isPopoverOpen
state is late to update, so the focus always fails. More info is explained on the proposal there.
After looking at the linked proposal, I remember we have a PR that will do a big refactor to the composer focus logic and when I look around the PR, I found that they will handle this issue too.
I don't think there is an easy way to handle this globally, so, sadly I think we should revert our PR and wait for the above PR. (except we want to handle this issue for LHN (report context menu) only, which means my main solution)
Let me know what you think!
⚠️ Looks like this issue was linked to a Deploy Blocker here
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
@mananjadhav can you review @bernhardoj 's comment above and propose the next best steps? Should I put this on hold pending https://github.com/Expensify/App/pull/29199 ?
I can see the PR is already reverted. Yes we should put this on Hold pending #29199
Issue is ready for payment but no BZ is assigned. @anmurali you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
Put on hold pending https://github.com/Expensify/App/pull/29199 Removed 'hold for payment' too
Held, nothing to do here!
https://github.com/Expensify/App/pull/29199 is still being worked on and this issue is on hold.
Still held, started a convo in C+ channel here
Also adding a BZ backup for my OOO
Current assignee @mallenexpensify is eligible for the Bug assigner, not assigning anyone new.
@mananjadhav, @anmurali, @mallenexpensify, @jasperhuangg, @bernhardoj Whoops! This issue is 2 days overdue. Let's get this updated quick!
Still on HOLD for https://github.com/Expensify/App/pull/29199
Same ^
Same ^^
@mananjadhav, @anmurali, @mallenexpensify, @jasperhuangg, @bernhardoj Whoops! This issue is 2 days overdue. Let's get this updated quick!
^^^ Same
Still on hold
Refactor is still in progress so this issue is still on hold.
Commented on the PR this is held on
Also.. are we sure that the behavior isn't intended? Whenever I click on a chat in LHN, my assumption is that the chat opens and the cursor is in the compose box. I understand that there was a pop up open previously but we w ouldn't expect that pop up to stay open if we navigated to another chat then immediately back again, right?
Maybe there are other examples I'm unaware of where we keep the pop up while taking other actions?
Putting on #vip-vsb for now, since this doesn't have to do with money
The issue we have here is that the composer is focused when we open a second popover.
Click on plus besides the composer to open Actions popup Right (click) on any chat in LHN to open popup on LHN Observe that even though popup is open in LHN, app still focuses on composer
Thanks @bernhardoj , I def missed that part :ohnothing: I was able to reproduce
I feel like it's a pretty rare edge case and it doesn't affect functionality. BUT... having that second popup from the LHN hang around isn't idea. Let's wait for this to come off hole then I'll retest then decide what to do with it.
Still on HOLD
Still held
@ntdiary will resume working on https://github.com/Expensify/App/pull/29199 This issue is still blocked on https://github.com/Expensify/App/pull/29199
Still blocked on https://github.com/Expensify/App/pull/29199
- Try to refactor the logic regarding refocusing when the modal is closed #29199 Held on above and it looks like it's still a draft
We split that large PR into several smaller ones. phase1 #35572 has already been merged, and phase2 #42423 is under review. :)
@ntdiary Awesome! Sounds like a good idea to split up the PR. Thanks for the update.
Above merged so we're getting close
The PR we were holding on closed without being fixed. I threw a retest-weekly
on here to see if the bug exists six months later.
@mallenexpensify @lanitochka17 Are we still retesting this on weekly cadence?
This bug still exists. I remember there was another PR that added a focus trap feature, which confines the focus within the popover(or RHP?), but it seems to be ineffective in this situation. 🤔
https://github.com/Expensify/App/assets/8579651/d5f9bfa1-91f1-4fcf-8905-0d4288896d39
@jasperhuangg retests take a weekish. @ntdiary and I are both able to reproduce so the bug still exists. I think we need to decide between
Help Wanted
to get more proposalsI don't think we need/want to increase the price though
I remember our app has an interesting feature: even if the main input box isn't focused, pressing the keyboard will still automatically focus it, allowing for smooth typing. 😄
https://github.com/Expensify/App/assets/8579651/c26c19cb-7f9d-424a-a3fc-b28df85b8fc4
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.11-6 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:
App should not focus back on composer whenever any popup is open
Actual Result:
App focuses back on composer when we open actions popup and open any right click popup in LHN
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
https://github.com/Expensify/App/assets/78819774/74137c5f-18a4-4e16-8ee5-d8ccfda09552
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @mallenexpensify