Fix: Chats - Selected chat is hidden when navigating via keyboard#51754
Fix: Chats - Selected chat is hidden when navigating via keyboard#51754marcochavezf merged 4 commits intoExpensify:mainfrom
Conversation
|
@rayane-djouah 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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-11-05.at.7.59.43.PM.movAndroid: mWeb ChromeScreen.Recording.2024-11-05.at.7.54.44.PM.moviOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-11-05.at.20.29.58.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-11-05.at.19.21.57.mp4MacOS: Chrome / SafariScreen.Recording.2024-11-05.at.6.58.51.PM.movMacOS: DesktopScreen.Recording.2024-11-05.at.7.03.15.PM.mov |
rayane-d
left a comment
There was a problem hiding this comment.
Instead of passing searchType to BaseSelectionList, consider passing a shouldKeepFocusedItemAtTopOfViewableArea boolean prop. This would make the solution reusable and help keep BaseSelectionList more abstract.
src/components/Search/index.tsx
Outdated
| } | ||
| contentContainerStyle={[contentContainerStyle, styles.pb3]} | ||
| scrollEventThrottle={1} | ||
| searchType={type} |
There was a problem hiding this comment.
| searchType={type} | |
| shouldKeepFocusedItemAtTopOfViewableArea={type === CONST.SEARCH.DATA_TYPES.CHAT} |
| scrollEventThrottle, | ||
| contentContainerStyle, | ||
| shouldHighlightSelectedItem = false, | ||
| searchType = '', |
There was a problem hiding this comment.
| searchType = '', | |
| shouldKeepFocusedItemAtTopOfViewableArea = false, |
| // Since there are always two items above the focused item in viewable area, and items can grow beyond the screen size | ||
| // in searchType chat, the focused item may move out of view. To prevent this, we will ensure that the focused item remains at | ||
| // the top of the viewable area at all times by adjusting the viewOffset. | ||
| if (searchType === 'chat') { |
There was a problem hiding this comment.
| if (searchType === 'chat') { | |
| if (shouldKeepFocusedItemAtTopOfViewableArea) { |
Let's also adjust the comment
Yup, that's a good idea 👍 |
…TopOfViewableArea` instead of `searchType`
|
@tushar-a-b Let's clarify the QA tests (Add expected behaviour): |
Yes, Thanks! @rayane-djouah |
|
@marcochavezf all yours! |
|
✋ 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/marcochavezf in version: 9.0.59-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.59-3 🚀
|
Explanation of Change
This PR addresses an issue where focused chat moves out of view in search chats section.
Fixed Issues
$ #48902
PROPOSAL: #48902 (comment)
Tests
Precondition:
Steps:
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.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
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4