-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix focus loss after message deletion in edit mode #49538
Conversation
@brunovjk, It seems the linting error in
|
Good work so far @Shahidullah-Muffakir. Good question, I'll ask on Slack about it and get back here. Thanks. |
@brunovjk, my bad about the earlier message. I got it wrong. The linting error is actually in the same file where we made our PR changes. We will modify
To:
|
Great @Shahidullah-Muffakir! I'm waiting for someone to comment on Slack, if nothing happens by Monday, please feel free to make the necessary updates and then we'll hand it over to an internal reviewer. What do you think? Thanks. |
@brunovjk, Sounds good to me. We'll wait until Monday for any comments on Slack. Thank you! |
@Shahidullah-Muffakir Do you also see a delay to focus the composer? Thanks. Screen.Recording.2024-09-21.at.11.45.50.movChorme: Screen.Recording.2024-09-21.at.11.46.42.movIn Screen.Recording.2024-09-21.at.11.55.15.movI wonder if in native it should focus the composer after deleting/editing a message, according to the issue "Web/Desktop - Chat - Focus is lost ..." I dont think so, what do you think @youssef-lr? Thank you. |
@brunovjk, Yes, I see the same delay in focusing the composer. It seems like the delay might be caused by the time it takes to process the message deletion request. I believe this line of code could be the reason for the delay:
Not sure if there’s much we can do about this, Thank you. |
@Shahidullah-Muffakir Let's move forward and resolve this lint issue, okay? |
@brunovjk, Sure, I'll take care of the lint issue. As for the native apps, the issue description (#45472) mentions pressing the Up Arrow Key to edit a message. Since that's not possible on mobile apps, that's why I said it's only supported on desktop and web. However, on mobile, if we edit a comment by tapping on it, clear the text, and confirm the deletion through the modal, the input is refocused as expected. I tested this, and it works fine on mobile. Screen.Recording.2024-09-24.at.2.08.31.AM.mov |
@brunovjk I’ve fixed the linting issue. Thank you. |
The changes seem good to me @Shahidullah-Muffakir, but I'm still unsure about the expected behavior on different platforms. I tested on Web and Desktop and apart from the small delay it seems good to me: MacOS: Chrome / Safari49538_web_chorme.movMacOS: Desktop49538_web_desktop.movOn emulators, both web and native, the composer is not focused after deleting a comment, but even when editing (which is not the focus of this PR) the composer is not focused as well. Android: Native49538_android_native.movAndroid: mWeb Chrome49538_android_web.moviOS: Native49538_ios_native.movWith that, @youssef-lr Do you confirm that the main composer should be focused when deleting messages only on web/desktop? I didn't find any reported issue about the main composer not being focused when editing either. Can you confirm the expected behavior of "focus main composer" on different platforms after deleting a message? Thank you very much. |
I think it's the same behavior on every platform. |
@Shahidullah-Muffakir Following @youssef-lr s comment, do you think we can update the behavior? At first glance it seems a bit out of scope, I'm not sure, but if that's the case we can try an increase in compensation (not guaranteed). Please, let me know what you think and your findings. Thank you. |
Hi @youssef-lr and @brunovjk, I'm not sure if it's necessary to focus on the input field in the native apps. Based on a discussion I found in our Slack channel, the reason we don't focus the composer in native apps is that it would trigger the keyboard to open, which takes up half the screen. This isn't ideal for the user experience. We don't want to assume the user wants to start typing immediately, and the sudden appearance of the keyboard can feel jarring. Links to the slack discussions: https://expensify.slack.com/archives/C01GTK53T8Q/p1696528231560429 Also, since the original issue only mentions desktop, this could be why the focus behavior is different there. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid-.Native.movAndroid: mWeb ChromeAndroid-.mWeb.Chrome.moviOS: NativeiOS-.Native.moviOS: mWeb SafariiOS-.web.movMacOS: Chrome / SafariMacOS-.Chrome.Safari.movMacOS: DesktopMacOS-.Desktop.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great @Shahidullah-Muffakir! This is the investigation we needed, good work!! Thank you.
I just retested it and everything looks good to me :D Do you agree @youssef-lr?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/youssef-lr in version: 9.0.48-0 🚀
|
🚀 Deployed to production by https://github.com/marcaaron in version: 9.0.48-2 🚀
|
Details
This PR fixes a problem where deleting a message while editing causes the text input area (composer) to lose focus. The issue was caused by a mistake in how a callback function was assigned, which led to unexpected behavior. The solution is to call the runAndResetCallback function directly to make sure it works correctly and resets as needed. Also, I corrected some typos in the references to onConfirmDeleteModal to avoid any future errors.
Fixed Issues
$#45472
PROPOSAL:#45472 (comment)
Tests
Offline tests
Same as tests.
QA Steps
same as tests.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
This feature is only supported on the desktop app and web.
Android: mWeb Chrome
This feature is only supported on the desktop app and web.
iOS: Native
This feature is only supported on the desktop app and web..
iOS: mWeb Safari
This feature is only supported on the desktop app and web.
MacOS: Chrome / Safari
safari.mov
MacOS: Desktop
desktop.mov