-
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 wrong scrolling in Search list when navigating by keyboard #43490
Fix wrong scrolling in Search list when navigating by keyboard #43490
Conversation
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
3d3743e
to
8575219
Compare
src/libs/SearchUtils.ts
Outdated
@@ -155,7 +157,7 @@ function getReportSections(data: OnyxTypes.SearchResults['data']): ReportListIte | |||
} | |||
} | |||
|
|||
return Object.values(reportIDToTransactions); | |||
return Object.values(reportIDToTransactions).filter((item) => item.transactions?.length !== 0); |
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 started filtering this on the backend, so we shouldn't have to do it in the frontend anymore.
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.
Fair enough but I found such cases that fallen into this if: https://github.com/Expensify/App/blob/main/src/components/SelectionList/Search/ReportListItem.tsx#L82 or the other one.
At lest for me I can see empty list elements.
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 put up a fix for this, so we should be able to remove the filter once my fix is deployed.
const transactionItemMobileHeight = 100; | ||
const reportItemTransactionHeight = 52; | ||
const listItemPadding = 12; // this is equivalent to 'mb3' on every transaction/report list item |
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.
NAB This feels brittle since if the height changes we would introduce the bug again. That being said, I'm not sure how to solve it this.
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.
Exactly same for me. We could in some way extract the same variable from styles perhaps and use, but still you would have to change it in two places.
I agree that its brittle but I see no other simple solution. padding affects item height, and correct item height has to be pushed down to RN List
@fedirjh all yours |
Bump @fedirjh for review |
Reviewer Checklist
Screenshots/VideosAndroid: NativeCleanShot.2024-06-18.at.12.36.03.mp4Android: mWeb ChromeCleanShot.2024-06-18.at.12.43.23.mp4iOS: NativeCleanShot.2024-06-18.at.12.04.52.mp4iOS: mWeb SafariCleanShot.2024-06-18.at.12.12.07.mp4MacOS: Chrome / SafariCleanShot.2024-06-18.at.11.01.55.mp4MacOS: DesktopCleanShot.2024-06-18.at.11.24.12.mp4CleanShot.2024-06-18.at.11.24.51.mp4 |
@Kicu The navigation using the TAB key is not smooth; it feels there is a delay: CleanShot.2024-06-14.at.14.03.15.mp4 |
@fedirjh do you mind checking if the same feeling when using TAB appears also on main, and if not then can we move forward? |
@Kicu Yes it seems this behavior is happening on main as well. There is another bug with scrolling, it took several clicks to navigate between the first item and the second (3-4 clicks) CleanShot.2024-06-17.at.09.59.11.mp4Also, the scrolling behavior looks weird; sometimes it takes two or three clicks to navigate to the next item: CleanShot.2024-06-17.at.10.01.31.mp4 |
Yeah I'm pretty sure I understand what happens 👍 Unfortunately there are empty "invisible" items on this list, and I was not sure if its only for me or is this more common. Now that I know I will filter them out and that should help. |
@fedirjh please re-check, the weird navigation behaviour should be fixed |
@Kicu Yep results look good so far. navigating between items is now fixed. For scrolling, there is still a little weirdness, the list sometimes scrolls up and down when you have a large item in the list: I think this is related to the fact that we have two scrolling behaviors implemented at the same time :
I think we probably should disable the SectionList auto-scrolls on item focus behavior. I am not sure it that's possible, though. CleanShot.2024-06-17.at.10.56.13.mp4 |
will look into this later today or tomorrow and ping you |
I'll take a look since we should be filtering those in the backend. |
I put up a PR to fix the report without transactions issue. You can remove the filtering in the frontend again since the fix for that issue is in the backend. |
@fedirjh I looked at the scrolling behaviors in our That being said I think this is a bigger problem and this behaviour that we see here is what happens everywhere in the app where rec-web-sorting.mp4I think the only difference here is that Search is currently the only list in Expensify where items can have different heights. Other than that, this is simply how CC @luacmartins |
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.
Over to you @luacmartins
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/luacmartins in version: 1.4.86-0 🚀
|
1 similar comment
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.4.86-0 🚀
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 1.4.86-0 🚀
|
This PR is failing because of issue #43362 The issue is reproducible in: Web and Desktop 1718884561366.Fix_wrong_scrolling_in_Search_list_when_navigating_by_keyboard.mp41718886939047.43490_desktop.mp4 |
@kbecciv Sorry but I'm not sure I understand. This PR was specifically fixing the issue that you mention: #43362 Right now I re-tested current |
🚀 Deployed to production by https://github.com/AndrewGable in version: 9.0.0-9 🚀
|
Details
Root cause
SelectionList
was not prepared to handle items of different sizes and/or items with extra padding. InsideBaseSelectionList
there is an implementation ofgetItemLayout
(https://reactnative.dev/docs/virtualizedlist#getitemlayout) function that returns sizes of items and it has a hardcoded value here: https://github.com/Expensify/App/blob/main/src/components/SelectionList/BaseSelectionList.tsx#L157-L159Search
we have items with padding, which makes them bigger than 64, and also we have different sized itemsDone:
SelectionList
interface:getHeight
because it was called at least 3 times per item per render, which for me meant 200-500 calls - feels like a lotnull
items with height 0)Fixed Issues
$ #43362
PROPOSAL:
Tests
Search
Tab
key, and alsoup
anddown
keyboard keysOffline tests
QA Steps
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
rec-web-sorting-scroll.mp4
rec-web-mobile-sorting.mp4
MacOS: Desktop