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
[$500] Compose Box - Focus not lost from composer on LHN popup open #32970
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:
Open the app
Open any report and send any message
Focus on composer
Click on plus besides the composer to open Actions popup
Right on any chat in LHN to open popup on LHN
Observe that even though popup is open in LHN, app still focuses on composer
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?
changed the title [-] Compose Box - Focus not lost from composer on LHN popup open[/-][+][$500] Compose Box - Focus not lost from composer on LHN popup open[/+]on Dec 13, 2023
What changes do you think we should make in order to solve the problem?
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.
What alternative solutions did you explore? (Optional)
We can add InteractionManager.runAfterInteractions here to wait the composer focus and then blur it.
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.
In 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:
Open add action (+) popover
Press the three-dots menu
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.
changed the title [-][HOLD #29199] [$500] Compose Box - Focus not lost from composer on LHN popup open[/-][+][$500] Compose Box - Focus not lost from composer on LHN popup open[/+]on Jun 19, 2024
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. 🤔
@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
Close it cuz it's a minor bug that doesn't affect functionality (I might actually prefer to be able to type and have the text fill the compose box vs nothing happening if I type)
Review existing proposals to see if we want to accept any
Add Help Wanted to get more proposals
Something.
I 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. 😄
Activity
[-] Compose Box - Focus not lost from composer on LHN popup open[/-][+][$500] Compose Box - Focus not lost from composer on LHN popup open[/+]melvin-bot commentedon Dec 13, 2023
Triggered auto assignment to @mallenexpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Dec 13, 2023
Job added to Upwork: https://www.upwork.com/jobs/~0123ed583fdc5774f0
melvin-bot commentedon Dec 13, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Dec 13, 2023
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (
External)dukenv0307 commentedon Dec 13, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
App focuses back on composer when we open actions popup and open any right click popup in LHN
What is the root cause of that problem?
When popover is closed,
onPopoverMenuCloseis called.App/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.js
Line 166 in d6755d6
And then
restoreKeyboardStateis called which makes the composer focused.App/src/pages/home/report/ReportActionCompose/ReportActionCompose.js
Line 193 in d6755d6
We already the logic here to blur the active element but the time this function is called, the active element isn't composer.
App/src/components/LHNOptionsList/OptionRowLHN.js
Line 195 in 8fa65ec
What changes do you think we should make in order to solve the problem?
We should pass
eventtoonPopoverMenuCloseand pass it toonMenuClosed. And then inrestoreKeyboardState, we should check if theevent.targetis a clickable element, we will not focus the composer.What alternative solutions did you explore? (Optional)
We can add
InteractionManager.runAfterInteractionshere to wait the composer focus and then blur it.App/src/components/LHNOptionsList/OptionRowLHN.js
Line 195 in 8fa65ec
bernhardoj commentedon Dec 13, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
The composer is focused if we close the add action popover by opening another popover.
What is the root cause of that problem?
Every time the add action popover closes, we call
restoreKeyboardStatewhich will refocus the keyboard.App/src/pages/home/report/ReportActionCompose/ReportActionCompose.js
Lines 193 to 199 in d6755d6
When we right-click the LHN item or chat report message, it will:
The composer focus will call
focusComposerWithDelayApp/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js
Lines 399 to 401 in d6755d6
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.App/src/libs/focusComposerWithDelay.ts
Lines 14 to 19 in d6755d6
What changes do you think we should make in order to solve the problem?
Don't focus if the report/LHN popover is visible. Both use the same component, PopoverReportActionContextMenu.
PopoverReportActionContextMenucalledisVisibleApp/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.js
Lines 272 to 282 in d6755d6
focusComposerWithDelay, early return ifPopoverReportActionContextMenu.isVisible()is true.What alternative solutions did you explore? (Optional)
I notice that this also happens if we:
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.
mananjadhav commentedon Dec 17, 2023
I liked @bernhardoj's proposal to fix this with
ComposerWithSuggestions's popover context visible state.🎀 👀 🎀 C+ reviewed
96 remaining items
[-][HOLD #29199] [$500] Compose Box - Focus not lost from composer on LHN popup open[/-][+][$500] Compose Box - Focus not lost from composer on LHN popup open[/+]mallenexpensify commentedon Jun 19, 2024
The PR we were holding on closed without being fixed. I threw a
retest-weeklyon here to see if the bug exists six months later.jasperhuangg commentedon Jul 1, 2024
@mallenexpensify @lanitochka17 Are we still retesting this on weekly cadence?
ntdiary commentedon Jul 2, 2024
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. 🤔
test.mp4
mallenexpensify commentedon Jul 3, 2024
@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 Wantedto get more proposalsI don't think we need/want to increase the price though
ntdiary commentedon Jul 3, 2024
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. 😄
demo.mp4
mallenexpensify commentedon Jul 5, 2024
Thanks @ntdiary , I'm going to close, comment/reopen if you disagree.