-
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 iOS Composer highlight flicker after closing attachment modal #54670
Fix iOS Composer highlight flicker after closing attachment modal #54670
Conversation
@shubham1206agra 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] |
@ikevin127 Can we fix this test too?
Main branch behavior is that the keyboard flickers, but this PR will not focus on the input. |
@shubham1206agra Yes, I can tackle that one, here's the solution I arrived to: In order to focus the edit input and fix the current main branch broken behaviour would require calling the Note With this, the hook will still call The reason why this is the only solution that works in our case to pass all tests and fix the current main branch issue is because with the previous solution, even if we keep the previous modal open logic and skip the early return for when edit composer is focused, this would still not focus the main composer after returning back from the edit composer (see video below). iOS: Native (no focus on main after edit)ios-no-focus-after-edit.mp4useEffect(() => {
if (!isFocused || !shouldResetFocusRef.current) {
return;
}
const interactionManagerRef = InteractionManager.runAfterInteractions(() => {
inputRef.current?.focus(); // focus input again
shouldResetFocusRef.current = false;
});
return () => interactionManagerRef.cancel();
}, [isFocused, inputRef]); with these changes the behaviour would cover all tests + fix the current broken behaviour from main branch: iOS: Native (preview)ios.mp4Please let me know if you agree with this approach and I will apply the changes right away! |
@ikevin127 Please make the changes. |
@shubham1206agra Updated solution was applied, PR is ready for review once again and is passing all tests including #54670 (comment). |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-01-08.at.12.58.28.PM.movAndroid: mWeb ChromeiOS: NativeScreen.Recording.2025-01-08.at.12.49.32.PM.moviOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2025-01-08.at.12.31.07.PM.movMacOS: DesktopScreen.Recording.2025-01-08.at.12.43.04.PM.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!
✋ 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/Beamanator in version: 9.0.83-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.83-5 🚀
|
1 similar comment
🚀 Deployed to production by https://github.com/thienlnam in version: 9.0.83-5 🚀
|
Explanation of Change
PR #34404 introduced the
useResetComposerFocus
in order to deal with issuehttps://github.com//issues/33466. Months after that we introducedComposeFocusManager
with PR #35572 which was put place in for advanced focus management when opening / closing modals. Because of the 2 conflicting focus callers we got the issue which this PR fixes - the fix is adjustinguseResetComposerFocus
to only call focus when we're not coming back from a modal (see PR #34404 test steps for details).Fixed Issues
$ #54615
PROPOSAL: #54615 (comment)
Tests
Note: This is a Native or HybridApp specific issue and fix.
Caution
On mWeb step (7.) will fail because it didn't work like that before this PR either - this can be verified on staging / production before this PR is deployed on any of the two. On mWeb the current / expected behaviour is that the composer won't re-focus when returning back from attachment modal.
Additional test steps from PR #34404 / #33466 Issue :
Caution
On mWeb step (6.) will fail because it didn't work like that before this PR either - this can be verified on staging / production before this PR is deployed on any of the two. On mWeb the current / expected behaviour is that the main composer and the edit comment composer will both show at the same time and none of them will be focused when returning back report details screen.
Offline tests
N/A.
QA Steps
Note: This is a Native or HybridApp specific issue and fix.
Caution
On mWeb step (7.) will fail because it didn't work like that before this PR either - this can be verified on staging / production before this PR is deployed on any of the two. On mWeb the current / expected behaviour is that the composer won't re-focus when returning back from attachment modal.
Additional test steps from PR #34404 / #33466 Issue :
Caution
On mWeb step (6.) will fail because it didn't work like that before this PR either - this can be verified on staging / production before this PR is deployed on any of the two. On mWeb the current / expected behaviour is that the main composer and the edit comment composer will both show at the same time and none of them will be focused when returning back report details screen.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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
android.mp4
Android: mWeb Chrome
android-mweb.mp4
iOS: Native
after-main.mp4
iOS: mWeb Safari
ios-mweb.mp4
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
desktop.mov