-
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
[CP Staging] Fix selecting items and animating Pages with SelectionList #40562
[CP Staging] Fix selecting items and animating Pages with SelectionList #40562
Conversation
@paultsimura 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] |
@fedirjh would you take it as a regression fix, please? |
Reviewer Checklist
Screenshots/VideosAndroid: NativeCleanShot.2024-04-19.at.20.07.16.mp4Android: mWeb ChromeCleanShot.2024-04-19.at.20.05.12.mp4iOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.-.2024-04-19.at.20.03.31.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.-.2024-04-19.at.20.01.25.mp4MacOS: Chrome / SafariCleanShot.2024-04-19.at.19.51.12.mp4MacOS: DesktopCleanShot.2024-04-19.at.20.07.57.mp4 |
@@ -94,6 +95,7 @@ function BaseSelectionList<TItem extends ListItem>( | |||
const itemFocusTimeoutRef = useRef<NodeJS.Timeout | null>(null); | |||
const [currentPage, setCurrentPage] = useState(1); | |||
const isTextInputFocusedRef = useRef<boolean>(false); | |||
const {didScreenTransitionEnd} = useScreenWrapperTranstionStatus(); |
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.
@WojtekBoman The bug appears to affect other pages where we use the BaseListItem without using a list , e.g. the StatusClearAfterPage :
Video
Screen.Recording.2024-04-19.at.8.32.53.PM.mov
I think it would be ideal if we move this check to the useSyncFocus
hook.
diff --git a/src/hooks/useSyncFocus/index.ts b/src/hooks/useSyncFocus/index.ts
index bdc4a6a876..8c516645d9 100644
--- a/src/hooks/useSyncFocus/index.ts
+++ b/src/hooks/useSyncFocus/index.ts
@@ -1,6 +1,7 @@
import {useLayoutEffect} from 'react';
import type {RefObject} from 'react';
import type {View} from 'react-native';
+import useScreenWrapperTranstionStatus from "@hooks/useScreenWrapperTransitionStatus";
/**
* Custom React hook created to handle sync of focus on an element when the user navigates through the app with keyboard.
@@ -8,13 +9,15 @@ import type {View} from 'react-native';
* To maintain consistency when an element is focused in the app, the focus() method is additionally called on the focused element to eliminate the difference between native browser focus and application focus.
*/
const useSyncFocus = (ref: RefObject<HTMLDivElement | View>, isFocused: boolean) => {
+ const {didScreenTransitionEnd} = useScreenWrapperTranstionStatus();
+
useLayoutEffect(() => {
- if (!isFocused) {
+ if (!isFocused || !didScreenTransitionEnd) {
return;
}
ref.current?.focus();
- }, [isFocused, ref]);
+ }, [didScreenTransitionEnd, isFocused, ref]);
};
export default useSyncFocus;
…tReportFieldDropdown
I've included in this PR also the fix for this issue: #40410. To solve this problem, I added a |
@fedirjh @roryabraham It's ready for another round of review :) |
@WojtekBoman This doesn't seem to fix the root cause of the issue. Even after implementing this fix, the bug persists when the text input loses focus. In such cases, if the selected item is not currently visible in the list, the list will automatically scroll to make it visible. Steps to reproduce :
CleanShot.2024-04-22.at.10.55.45.mp4 |
@fedirjh I've added one more adjustment, could you check it now? During this time I'll check if it's necessary to add |
…nLists where text input is displayed" This reverts commit a0e6f68.
Seems to be working fine for me. |
…t in EditReportFieldDropdown" This reverts commit d3f94ef.
I've reverted all changes that added |
Screenshots/Videos for #40410WebCleanShot.2024-04-22.at.11.42.59.mp4Mobile Web - ChromeCleanShot.2024-04-22.at.11.50.04.mp4Mobile Web - SafariCleanShot.2024-04-22.at.12.09.00.mp4DesktopCleanShot.2024-04-22.at.12.20.23.mp4iOSCleanShot.2024-04-22.at.12.13.59.mp4AndroidCleanShot.2024-04-22.at.11.56.42.mp4 |
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 to me
@fedirjh I see one thing that is a side effect of changes introduced in this PR: Screen.Recording.2024-04-22.at.13.37.37.mov |
I think that is ok to move ahead to fix the deploy blocker |
@WojtekBoman I think we can handle that in a followup PR. It doesn’t seem like it has a straightforward fix. Probably we can add new |
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.
Code LGTM. I'll test this real quick to confirm the selection for the tags works.
…-preferences-animation [CP Staging] Fix selecting items and animating Pages with SelectionList (cherry picked from commit 2c15ccc)
Issue #40410 is not completely fixed in web. bandicam.2024-04-22.21-06-36-698.mp4 |
Thanks for testing, from the video it seems like its mostly ok, but we need to make this reliable @WojtekBoman if you could continue with the clean up? thanks! |
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.63-21 🚀
|
@fedirjh @roryabraham
Details
This PR fixes an issue with the Notification preferences page transition and selecting items on pages with SelectionList.
Fixed Issues
$ #40426
$ #40410
PROPOSAL:
Tests / QA Steps
Test 1:
Test 2:
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2024-04-19.at.14.13.13.mov
Screen.Recording.2024-04-22.at.11.53.17.mov
MacOS: Desktop
Screen.Recording.2024-04-19.at.14.15.17.mov
Screen.Recording.2024-04-22.at.11.51.08.mov