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
[$1000] mweb - App does not refocus on compose box on message delete using edit mode on android chrome and app #22949
In delete popup, click on delete and observe that app does not refocus on compose box (works fine on web chrome)
Expected Result:
App should refocus on compose box on deleting message using edit mode as it does on web chrome
Actual Result:
App does not refocus on compose box on deleting message using edit mode
Workaround:
Unknown
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: 1.3.41-1 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 Notes/Photos/Videos: Any additional supporting documentation
Either saving or closing the edit composer, it will call deleteDraft which will try to focus back to the main composer (ReportActionComposeFocusManager.focus()).
However, at this point, the main composer is still hidden. We will show the main composer back when the active edit composer is unmounted (or blurred).
// Show the main composer when the focused message is deleted from another client
// to prevent the main composer stays hidden until we swtich to another chat.
setShouldShowComposeInputKeyboardAware(true);
};
So, the focus always fails.
What changes do you think we should make in order to solve the problem?
When we save/cancel the edit composer, the component will be unmounted. So, we should focus back on the main composer when the component is unmounted and also wait for the Onyx process to complete by making setShouldShowComposeInputKeyboardAware as a Promise.
Please re-state the problem that we are trying to solve in this issue.
Closing the edit composer does not re-focus the main composer on mweb.
What is the root cause of that problem?
As correctly pointed out by previous proposals, the root cause is that on small screens the main composer is hidden when the edit composer is visible. We're triggering focus when hiding the edit composer. However, It takes some time for the edit composer to hide and for the main composer to show up. This causes the main composer to be not focused.
What changes do you think we should make in order to solve the problem?
I think this problem is very common and we should queue our focus requests to the main composer. We already have a ReportActionComposeFocusManager and we can use it to queue the focus action. In order to do this, we can create a new variable called pendingFocus and set its value to false initially. Then we can change our current focus function inside ReportActionComposeFocusManager to be:
function focus() {
if (!_.isFunction(focusCallback)) {
pendingFocus = true;
return;
}
focusCallback();
pendingFocus = false;
}
Similarly, the clear function would be changed to:
function clear() {
focusCallback = null;
pendingFocus = false;
}
Lastly, the onComposerFocus function would be changed to:
function onComposerFocus(callback) {
focusCallback = callback;
if (pendingFocus) {
callback();
pendingFocus = false;
}
}
Result
Screen.Recording.2023-07-16.at.7.17.05.PM.mov
What alternative solutions did you explore? (Optional)
From your video, I found another bug of glitch which means try to refocus again and failed
Looks like on my end (emulator and real device), it refocuses back to the edit composer. Anyway, we need to decide first whether to refocus back to main composer or not.
I don't think it's expected behavior to refocus upon cancelling edit mode on mobile. Keyboard re-popup really annoys users including me.
Refocus happens after deleting message on edit mode on android chrome. This is inconsistency bug to fix I think, as native and mSafari don't refocus at all.
Activity
melvin-bot commentedon Jul 15, 2023
Triggered auto assignment to @tjferriss (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jul 15, 2023
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)ahmdshrif commentedon Jul 15, 2023
Proposal
Please restate the problem that we are trying to solve in this issue.
when deleting the edit message main composer does not focus again.
also when canceling the edit composer does not focus again.
What is the root cause of that problem?
main composer set is not render whe we edit message and we run show composer and focus without wait the composer render again.
App/src/pages/home/report/ReportActionItemMessageEdit.js
Lines 202 to 203 in 6e5b07c
What changes do you think we should make in order to solve the problem?
we can simply wait until the composer is showing and then focus it using runAfterInteractions.
What alternative solutions did you explore? (Optional)
N/A
Screen_Recording_20230716_004412_Chrome.mp4
bernhardoj commentedon Jul 16, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
On mobile web, closing the edit composer does not refocus back the main composer.
What is the root cause of that problem?
On a small-screen device, when we focus on an edit composer, the main composer will hide.
App/src/pages/home/report/ReportActionItemMessageEdit.js
Line 418 in ef3d8cd
Either saving or closing the edit composer, it will call
deleteDraftwhich will try to focus back to the main composer (ReportActionComposeFocusManager.focus()).App/src/pages/home/report/ReportActionItemMessageEdit.js
Lines 288 to 297 in ef3d8cd
However, at this point, the main composer is still hidden. We will show the main composer back when the active edit composer is unmounted (or blurred).
App/src/pages/home/report/ReportActionItemMessageEdit.js
Lines 192 to 208 in ef3d8cd
So, the focus always fails.
What changes do you think we should make in order to solve the problem?
When we save/cancel the edit composer, the component will be unmounted. So, we should focus back on the main composer when the component is unmounted and also wait for the Onyx process to complete by making
setShouldShowComposeInputKeyboardAwareas a Promise.To make
setShouldShowComposeInputKeyboardAwareas a Promise,App/src/libs/actions/Composer.ts
Lines 4 to 6 in ef3d8cd
setShouldShowComposeInputKeyboardAware/index, return the promise fromComposer.setShouldShowComposeInputApp/src/libs/setShouldShowComposeInputKeyboardAware/index.ts
Lines 4 to 6 in ef3d8cd
setShouldShowComposeInputKeyboardAwareBuilder, return a new Promise object which will be resolved byComposer.setShouldShowComposeInputpromise.App/src/libs/setShouldShowComposeInputKeyboardAware/setShouldShowComposeInputKeyboardAwareBuilder.ts
Lines 10 to 32 in ded13be
allroundexperts commentedon Jul 16, 2023
Proposal
Please re-state the problem that we are trying to solve in this issue.
Closing the edit composer does not re-focus the main composer on mweb.
What is the root cause of that problem?
As correctly pointed out by previous proposals, the root cause is that on small screens the main composer is hidden when the edit composer is visible. We're triggering focus when hiding the edit composer. However, It takes some time for the edit composer to hide and for the main composer to show up. This causes the main composer to be not focused.
What changes do you think we should make in order to solve the problem?
I think this problem is very common and we should queue our
focusrequests to the main composer. We already have aReportActionComposeFocusManagerand we can use it to queue the focus action. In order to do this, we can create a new variable calledpendingFocusand set its value tofalseinitially. Then we can change our currentfocusfunction insideReportActionComposeFocusManagerto be:Similarly, the
clearfunction would be changed to:Lastly, the
onComposerFocusfunction would be changed to:Result
Screen.Recording.2023-07-16.at.7.17.05.PM.mov
What alternative solutions did you explore? (Optional)
None
tjferriss commentedon Jul 17, 2023
I'm not able to reproduce the issue on the desktop app. The app correctly refocuses on the compose box.
Screen.Recording.2023-07-17.at.10.37.12.mov
dhanashree-sawant commentedon Jul 17, 2023
Hi @tjferriss, the issue is specifically on android chrome and android app, sorry for confusion, it is not on desktop app
allroundexperts commentedon Jul 18, 2023
@tjferriss This is still easily reproducible on android chrome. Can you please open this?
tjferriss commentedon Jul 18, 2023
Thanks @allroundexperts. I've re-opened so we can investigate.
89 remaining items
aimane-chnaif commentedon Nov 30, 2023
Refocus still happens after deleting message on android chrome. This is bug to fix I think as native, mSafari doesn't refocus at all.
bernhardoj commentedon Nov 30, 2023
It didn't refocus on me.
Screen.Recording.2023-11-30.at.17.00.14.mov
If we look at the code, we want to refocus the composer when deleting a draft.
App/src/pages/home/report/ReportActionItemMessageEdit.js
Lines 285 to 297 in 2febad0
The refocus will only work for web platform (willBlurTextInputOnTapOutside).
App/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.js
Lines 411 to 420 in 2febad0
But it's currently not working on mWeb (at least on my end)
Maybe we should clarify the expected behavior here.
Do we want to refocus back to the main composer after closing the edit composer (web only)?
If not, then we can remove the logic from the edit composer.
aimane-chnaif commentedon Nov 30, 2023
I tested on physical device. From your video, I found another bug of glitch which means try to refocus again and failed
aimane-chnaif commentedon Nov 30, 2023
reproducible on android emulator as well
android.emulator.mov
bernhardoj commentedon Nov 30, 2023
Looks like on my end (emulator and real device), it refocuses back to the edit composer. Anyway, we need to decide first whether to refocus back to main composer or not.
melvin-bot commentedon Dec 2, 2023
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
aimane-chnaif commentedon Dec 2, 2023
I don't think it's expected behavior to refocus upon cancelling edit mode on mobile. Keyboard re-popup really annoys users including me.
Refocus happens after deleting message on edit mode on android chrome. This is inconsistency bug to fix I think, as native and mSafari don't refocus at all.
🎀 👀 🎀 to confirm with engineer
melvin-bot commentedon Dec 2, 2023
Triggered auto assignment to @yuwenmemon, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
tjferriss commentedon Dec 5, 2023
I tend to agree with @aimane-chnaif synopsis above. I think we can safely close this issue and revisit it down the road.