-
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: Workspace switcher - Selection disappears after erasing character with workspace selected. #44222
Conversation
…r with workspace selected. Signed-off-by: Krishna Gupta <[email protected]>
@dubielzyk-expensify @hoangzinh One of you needs to 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] |
@@ -539,14 +539,16 @@ function BaseSelectionList<TItem extends ListItem>( | |||
|
|||
const prevTextInputValue = usePrevious(textInputValue); | |||
const prevSelectedOptionsLength = usePrevious(flattenedSections.selectedOptions.length); | |||
const prevAllOptionsLength = usePrevious(flattenedSections.allOptions.length); | |||
|
|||
useEffect(() => { | |||
// Avoid changing focus if the textInputValue remains unchanged. | |||
if ((prevTextInputValue === textInputValue && flattenedSections.selectedOptions.length === prevSelectedOptionsLength) || flattenedSections.allOptions.length === 0) { | |||
return; | |||
} | |||
// Remove the focus if the search input is empty or selected options length is changed else focus on the first non disabled 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.
Can you update the comment here as well?
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.
updated to:
// Remove the focus if the search input is empty or selected options length is changed (and allOptions length remains the same)
// else focus on the first non disabled item
Signed-off-by: Krishna Gupta <[email protected]>
@Krishna2323 can you merge the latest main to our PR? I'm getting this error when trying to do recordings |
@hoangzinh, done. |
oops @Krishna2323 lint is failed |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-06-26.at.20.14.56.android.movAndroid: mWeb ChromeScreen.Recording.2024-06-26.at.20.13.58.android.chrome.moviOS: NativeScreen.Recording.2024-06-26.at.20.10.43.ios.moviOS: mWeb SafariScreen.Recording.2024-06-26.at.20.11.58.ios.safari.movMacOS: Chrome / SafariScreen.Recording.2024-06-26.at.19.43.53.web.movMacOS: DesktopScreen.Recording.2024-06-26.at.19.44.39.desktop.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 production by https://github.com/jasperhuangg in version: 9.0.3-7 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 9.0.5-13 🚀
|
const newSelectedIndex = textInputValue === '' || flattenedSections.selectedOptions.length !== prevSelectedOptionsLength ? -1 : 0; | ||
// Remove the focus if the search input is empty or selected options length is changed (and allOptions length remains the same) | ||
// else focus on the first non disabled item | ||
const newSelectedIndex = |
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.
@hoangzinh 👋 , I think this might be a add on here, but we should had removed the focus if the search input is empty and prev search input not empty, the bug was caught during regression testing here, So not quite sure if the behaviour changed over the months.
This caused #50562
Details
Fixed Issues
$ #36140
PROPOSAL: #36140 (comment)
Tests
Workk
.k
.Offline tests
Workk
.k
.QA Steps
Workk
.k
.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_native.mp4
Android: mWeb Chrome
android_chrome.mp4
iOS: Native
ios_native.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web_chrome.mp4
MacOS: Desktop
desktop_app.mp4