Repository navigation
Fix search submit is called twice - #58703
Conversation
|
@mananjadhav 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] |
|
The solution here is entirely different from my proposal. When trying to apply my proposal, it doesn't cover all cases well. So, then I finally understand the real root cause of the issue. It all happens after this PR: #54807. One of the issue that the PR is trying to solve is that, when pressing Enter while the search input is empty (and no focused item), it does nothing. We have an App/src/components/Search/SearchPageHeader/SearchPageHeaderInput.tsx Lines 246 to 248 in e292fa1 It's passed down to However, it's not called. So, the PR added a workaround by calling the Because of this, pressing enter/submit while text input and item are focused, |
| shouldStopPropagation, | ||
| shouldPreventDefault, | ||
| isActive: !disableKeyboardShortcuts && !disableEnterShortcut && isFocused, | ||
| isActive: !disableKeyboardShortcuts && !disableEnterShortcut && isFocused && focusedIndex >= 0, |
There was a problem hiding this comment.
The root cause of why the onSubmitEditing isn't called is because we have an ENTER keyboard shortcut on the selection list that prevents default the Enter key, even though there is no item focused. After fixing this, when pressing Enter,
- If there is a focused item, then
onSubmitEditingwon't be called. - Else,
onSubmitEditingwill be called.
So, only 1 submitSearch will be triggered.
There was a problem hiding this comment.
hey! a bit late but that was a nice RCA and a nice fix 👍 I remember the ENTER behavior on search input was wonky for a long time 😅
Could you highlight specific case that wasn't covered and it should be added to the test steps may be? |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid-search-submit-fix.movAndroid: mWeb Chromemweb-chrome-search-submit-fix.moviOS: Nativeios-search-submit-fix.moviOS: mWeb Safarimweb-safari-search-submit-fix.movMacOS: Chrome / Safariweb-search-submit-fix.movMacOS: Desktopdesktop-search-submit-fix.mov |
|
✋ 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/mollfpr in version: 9.1.18-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.1.18-4 🚀
|
Explanation of Change
Fixed Issues
$ #58162
PROPOSAL: #58162 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
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.mp4
Android: mWeb Chrome
android.mweb.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios.mweb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4