added composer focus glitch fix - #29073
Conversation
Signed-off-by: Ayaz Alavi <ayaz.alavi@gmail.com>
Signed-off-by: Ayaz Alavi <ayaz.alavi@gmail.com>
Signed-off-by: Ayaz Alavi <ayaz.alavi@gmail.com>
|
@narefyev91 Please 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] |
Signed-off-by: Ayaz Alavi <ayaz.alavi@gmail.com>
| }, [isFocused]); | ||
|
|
||
| useEffect(() => { | ||
| if (Platform.OS === 'web' && !Browser.isMobile()) { |
There was a problem hiding this comment.
we should not use such checks - you need to create a separate files for handle web and other platforms
| if (Platform.OS === 'web' && !Browser.isMobile()) { | ||
| InputFocus.composerFocusKeepFocusOn(textInputRef.current, isFocused, modal, onyxFocused); | ||
| } | ||
| return () => {}; |
There was a problem hiding this comment.
i think this is not needed
Signed-off-by: Ayaz Alavi <ayaz.alavi@gmail.com>
Signed-off-by: Ayaz Alavi <ayaz.alavi@gmail.com>
|
@ayazalavi hey! Seems issue with jumping borders are not fixed on desktop Screen.Recording.2023-10-09.at.17.52.17.movScreen.Recording.2023-10-09.at.17.50.23.movAlso i think default behaviour now changed - when i open a comment for edit -> open shortcuts modal -> and close it: Also when i after it click on main composer -> open shortcuts modal -> and close it: Screen.Recording.2023-10-09.at.17.56.40.mov |
Signed-off-by: Ayaz Alavi <ayaz.alavi@gmail.com>
Signed-off-by: Ayaz Alavi <ayaz.alavi@gmail.com>
3035b04 to
a127491
Compare
|
@narefyev91 I have uploaded I am using the same technique on mobile to return focus to the last input field we had focused on. Other than that, the React Native modal also returns focus to the last input it had focus on. So, this is the default behavior as well. Untitled.9.mp4Other than that if user explicitly set focus on compose box then focus will stay there. This matches with mobile web as well. Untitled.10.mp4 |
|
@narefyev91 have you been able to check PR? any more changes you want? |
in progress |
|
@ayazalavi one think i noticed comparing how staging and local changes are working staging.movLocally: locally.mov |
|
Hmmm interesting we have some different behaviours between web, mobile web and native |
|
@narefyev91, yes, all three platforms have different implementations. React Native Modal, by default, puts focus back on the last input that was focused. So, I am trying to maintain that behavior while avoiding the glitch. Secondly, if the edit message is opened, then it makes perfect sense to put the focus back on it once the modal gets closed unless the user explicitly clicks on the main composer box. If it is possible to merge this PR by tomorrow, then I'll be really grateful to get the bonus. |
|
@ayazalavi I tested on web and desktop - looks good Screen.Recording.2023-10-11.at.16.25.53.mov |
React native modal puts focus back to the last input that was focused before modal was opened. So as soon as user details page closes then basically focus will go back automatically to the edit input box. We cannot put focus back to main composer in this case. |
@ayazalavi Yes - it should focus edit composer - but as you can see on the video - it focused main composer when coming back from personal details screen |
Signed-off-by: Ayaz Alavi <ayaz.alavi@gmail.com>
okay got it, I have added changes. |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromeandroid-web.movMobile Web - Safariios-web.movDesktopdesktop.moviOSios.movAndroidandroid.mov |
narefyev91
left a comment
There was a problem hiding this comment.
LGTM! Working fine and resolved the main issue
🎀 👀 🎀 C+ reviewed
|
@amyevans, I hope you're well. Could you please review my pull request as soon as possible? Your prompt feedback would be highly appreciated. Thank you in advance for your quick attention. |
|
Sorry, it's on my to do list, I just have several higher priority items I need to get through first. Aiming for later today or tomorrow at the latest. |
amyevans
left a comment
There was a problem hiding this comment.
Looks good, thanks guys!
|
✋ 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 Duration
Show details
Meaningless Changes To DurationShow entries
Show details
|
|
@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker. |
|
@narefyev91 Can we reopen this PR and send update with the performance fix? |
|
The test is not working accurately right now (it's applying it to all merged PRs at the moment), this is a known issue. I'm going to remove the deploy blocker label. |
|
Thanks @amyevans for clarifying the issue. |
|
🚀 Deployed to staging by https://github.com/amyevans in version: 1.3.84-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.84-10 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.84-10 🚀
|
|
🚀 Deployed to staging by https://github.com/amyevans in version: 1.3.85-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.85-4 🚀
|
| } | ||
| if (!isFocused && !onyxFocused && !modal.willAlertModalBecomeVisible && !modal.isVisible && refSave) { | ||
| if (!ReportActionComposeFocusManager.isFocused()) { | ||
| refSave.focus(); |
There was a problem hiding this comment.
Coming from issue #58846, the focus is called too quickly before the dismiss modal is finished, resulting in a failed focus. We need to add InteractionManager.runAfterInteractions to ensure that the focus is triggered after the RHP is fully closed.
Proposal: #58846 (comment)
Details
In this PR, I have added a method to maintain focus on the input box by passing its input reference and modal status. This prevents the composer from stealing focus away from that input box.
Fixed Issues
Tests
Offline tests
same as online
QA Steps
same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.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.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
Untitled.1.mp4
Untitled.2.mp4
Mobile Web - Chrome
Untitled.4.mp4
Mobile Web - Safari
Untitled.3.mp4
Desktop
Untitled.5.mp4
iOS
Should work same as before
Android
Should work same as before