-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix mWeb Compose Focus bug #14230
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 mWeb Compose Focus bug #14230
Conversation
…on compose button when modals close
…on for variable in composer component
|
@eVoloshchak @ctkochan22 One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
marcaaron
left a comment
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.
Looks pretty good to me just made some code clean up suggestions. Really great detective work on this one. Feel like we got to the root cause here and then presented a solution that addresses it well.
marcaaron
left a comment
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.
Nice changes thanks!
|
The code looks good! I've found an issue when choosing "Add attachment" option: when you dismiss attachment modal, the input is correctly focused, but it's hidden by the keyboard because the screen didn't scroll up. video_2023-01-23_14-01-05.mp4I've tested this on Pixel 4 emulator and it doesn't have this problem, so this is most certainly depends on the flavor of Android. |
|
😭 oh bother... I think I saw some other discussions or maybe code comments about this, @marcaaron do you remember anything about this? I've definitely noticed that same thing happening on other apps too (not saying we shouldn't fix it) so that might be a somewhat common problem people end up needing to fix, going to see if I can see what the internet has to say about it. |
I don't sorry 😞 |
|
okay sorry I haven't had a chance to dig back in on this one. @eVoloshchak which emulator is your video from? I'm going to see about testing this on my phone (pixel 6) to see if it's reproducible there and will report back. |
|
ah awesome. My pixel is on Android 13 so I'll test again today with it and see what happens. |
|
okay after getting this branch built on my phone (pixel 6 android 13) I wasn't able to reproduce either. Wonder if maybe it's an android 12 thing or maybe specific to Samsungs even? |
|
I have a samsung tablet with android 13 that I'm going to see if I can build the app on 🙏 |
|
Yep I can't reproduce on my samsung tablet with android 13 so I think it's probably something with android 12 then. I'm not sure what Android versions we fully support? The hope is we end up cleaning up the behavior on a follow up issue with focus going back and forth and hiding/showing the keyboard so I think we could probably merge this and clean up anything else on a follow up. |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-01-31.at.15.24.18.movMobile Web - ChromeScreen_Recording_20230131-153539_Chrome.mp4Mobile Web - SafariScreen.Recording.2023-01-31.at.15.32.35.movDesktopScreen.Recording.2023-01-31.at.15.26.14.moviOSScreen.Recording.2023-01-31.at.15.30.50.movAndroidScreen_Recording_20230131-153713_New.Expensify.mp4 |
eVoloshchak
left a comment
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!
There is a visual bug when using this branch, so tested with changes applied to main
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Performance Comparison Report 📊Significant Changes To DurationThere are no entries Meaningless Changes To DurationShow entries
Show details
|
|
🚀 Deployed to staging by https://github.com/bondydaa in version: 1.2.63-0 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.63-0 🚀
|
| > | ||
| <Composer | ||
| autoFocus={!this.props.modal.isVisible && (this.shouldFocusInputOnScreenFocus || this.isEmptyChat())} | ||
| autoFocus={!this.props.modal.isVisible && (this.willBlurTextInputOnTapOutside || this.isEmptyChat())} |
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.
Coming from #17187:
This was overlooked while replacing all shouldFocusInputOnScreenFocus occurrences. Actually no changes needed here. Native and mWeb should be consistent in autofocus behavior.
Details
Buckle up this is a doozy.
Bug exists because React Native handles UX differently between web/mWeb/Desktop and native platform - for iOS and Android when a TextInput has focus tapping/clicking away from that input won't "blur" the input and focus will remain unless another TextInput is given focus. Web/mWeb/Desktop allows focus to blur how you would expect by clicking/tapping outside of an input.
With how can
canFocusInputOnScreenFocusto detect between platform it is wrongly assuming b/c mWeb has touch events that the Native UX for focus will be there and that we don't need to trigger the code to manually give focus back to the compose component.We are mainly focusing on fixing the bug here for now. We'll spin up a new issue to address the UX inconsistencies around the focusing of the compose component in a new issue.
Fixed Issues
$ #13443
Tests
Offline tests
N/A same as QA steps since this is just some UX that doesn't involve specific offline behavior
QA Steps
+icon to reveal the add attachment or split/request money modal+icon to reveal the add attachment or split/request money modalxto dismiss it.PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.Screenshots/Videos
Web
2023-01-13_15-22-23.mp4
Mobile Web - Chrome
android-chrome.mp4
Mobile Web - Safari
ios-safari.mp4
Desktop
desktop.mp4
iOS
ios-native.mp4
Android
android-native.mp4