-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
added composer focus glitch fix #29073
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>
@@ -124,6 +129,39 @@ function ReportActionItemMessageEdit(props) { | |||
isFocusedRef.current = isFocused; | |||
}, [isFocused]); | |||
|
|||
useEffect(() => { | |||
if (Platform.OS === 'web' && !Browser.isMobile()) { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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! 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. |
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 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 🚀
|
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
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