-
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
[$250] Android/iOS- Highlighted search result go to search page rather that the highlighted detail page #53401
Comments
Triggered auto assignment to @luacmartins ( |
💬 A slack conversation has been started in #expensify-open-source |
Triggered auto assignment to @MitchExpensify ( |
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
|
Demoting to NAB since it's just highlighting the wrong item. This is likely the offending PR @nyomanjyotisa @Pujan92 |
@luacmartins, @MitchExpensify Whoops! This issue is 2 days overdue. Let's get this updated quick! |
@luacmartins This doesn't seem to be from #52298, as we have specific logic on search input submit. I think for smaller screens the first item should not be highlighted in the selection list when the sections data are altered to avoid this issue. |
The expected behavior here is to open the "Admin" room or whatever search row is highlighted, not return to search right? Its not super clear in the OP so wanted to double check what we're aiming for here @luacmartins |
Correct, it should open the |
Should we implement this then? Or should we update the logic on search input submit to open Admin room in this case? Because in native platforms, it will always execute |
I think the behavior should be consistent on all platforms, so we should highlight the first item again once the search is altered |
Job added to Upwork: https://www.upwork.com/jobs/~021866990715543185912 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 ( |
@luacmartins Could you please confirm the nexts steps here ?
|
@luacmartins @MitchExpensify @ikevin127 this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Reminder on this @luacmartins |
As pointed out here, I don't think this issue is a regression, so we're open to proposals |
@luacmartins, @MitchExpensify, @ikevin127 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
Still looking for proposals |
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Android/iOS- Highlighted search result go to search page rather that the highlighted detail page What is the root cause of that problem?On smaller screens, the top-most result in Recent Chats is not highlighted when the search router is opened for the first time. However, it will highlight the first item (from Recent Chats or Recent Searches, if available) when the user types in the search bar and then clears it. On native platforms specifically, every time the user presses the search icon on the keyboard (Enter), it will always execute App/src/components/Search/SearchRouter/SearchRouter.tsx Lines 188 to 203 in 207622d
And then will be called on this onSubmit App/src/components/Search/SearchRouter/SearchRouter.tsx Lines 281 to 287 in 207622d
What changes do you think we should make in order to solve the problem?We can create a new function that will handle the // Track if the user has typed initially
const [isInitialType, setIsInitialType] = useState(true); We set it to false on if (userQuery.length > 0) {
setIsInitialType(false);
} We also need const sortedRecentSearches = useMemo(() => {
return Object.values(recentSearches ?? {}).sort((a, b) => b.timestamp.localeCompare(a.timestamp));
}, [recentSearches]);
const recentSearchesData = sortedRecentSearches?.slice(0, 5).map(({query, timestamp}) => {
const searchQueryJSON = SearchQueryUtils.buildSearchQueryJSON(query);
return {
text: searchQueryJSON ? SearchQueryUtils.buildUserReadableQueryString(searchQueryJSON, personalDetails, reports, taxRates) : query,
singleIcon: Expensicons.History,
searchQuery: query,
keyForList: timestamp,
searchItemType: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.SEARCH,
};
}); const onSubmit = useCallback(() => {
if (!textInputValue && !isInitialType) {
const highlightedItem = recentSearchesData[0] || searchOptions.recentReports[0];
if (highlightedItem) {
onListItemPress(highlightedItem);
}
} else {
submitSearch(textInputValue);
}
}, [textInputValue, recentSearchesData, searchOptions.recentReports, onListItemPress, submitSearch]); <SearchRouterInput
...
onSubmit={onSubmit}
... What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?What alternative solutions did you explore? (Optional)POC iOS-Native.mp4 |
Edited by proposal-police: This proposal was edited at 2024-12-21 14:07:20 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Highlighted search result go to search page rather that the highlighted detail page What is the root cause of that problem?First, I will explain why the highlighted item on the mobile web can open the detail page when pressing Enter. We use App/src/components/SelectionList/BaseSelectionList.tsx Lines 746 to 752 in 4cd759c
App/src/components/SelectionList/BaseSelectionList.tsx Lines 399 to 407 in 4cd759c
And the selected item, when Enter is pressed, will be handled for search or navigation.
App/src/components/Search/SearchRouter/SearchRouter.tsx Lines 239 to 243 in eb896c6
In this case, we encountered an issue (mweb) where, if no item in the list is highlighted, pressing Enter does not trigger any action. Screen.Recording.2024-12-21.at.16.25.56.movFor native apps (Android/iOS), we detect the
App/src/components/Search/SearchRouter/SearchRouter.tsx Lines 285 to 287 in eb896c6
When we press App/src/components/Search/SearchRouter/SearchRouter.tsx Lines 188 to 203 in eb896c6
What changes do you think we should make in order to solve the problem?To resolve this issue in this ticket, on the native app, when Enter is pressed, if the text input value is empty, we need to check if a row is highlighted and then navigate to it.
Create getFocusedItem function const getFocusedItem = useCallback(() => {
const focusedOption = focusedIndex !== -1 ? flattenedSections.allOptions.at(focusedIndex) : undefined;
if (!focusedOption || (focusedOption.isDisabled && !focusedOption.isSelected)) {
return;
}
return focusedOption;
}, [focusedIndex, flattenedSections.allOptions]); App/src/components/SelectionList/BaseSelectionList.tsx Lines 737 to 743 in 4cd759c
Update to useImperativeHandle(ref, () => ({scrollAndHighlightItem, clearInputAfterSelect, updateAndScrollToFocusedIndex, updateExternalTextInputFocus, scrollToIndex, getFocusedItem}), [
scrollAndHighlightItem,
clearInputAfterSelect,
updateAndScrollToFocusedIndex,
updateExternalTextInputFocus,
scrollToIndex,
getFocusedItem,
]);
App/src/components/Search/SearchRouter/SearchRouter.tsx Lines 285 to 287 in eb896c6
onSubmit={() => {
const item = listRef.current?.getFocusedItem();
if (!item) {
submitSearch(textInputValue);
return;
}
onListItemPress(item);
}} or onSubmit={() => {
const item = listRef.current?.getFocusedItem();
if (!textInputValue && !isSearchQueryItem(item)) {
// or if (!textInputValue && item && !isSearchQueryItem(item)) {
onRouterClose();
if (item?.reportID) {
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(item?.reportID));
} else if ('login' in item) {
ReportUserActions.navigateToAndOpenReport(item.login ? [item.login] : [], false);
}
return;
}
submitSearch(textInputValue);
}} Regarding the mWeb issue, if we want to fix it in this ticket, we will update it as follows:
<TextInput
...
onKeyPress={(event) => {
const isWeb = getPlatform() === CONST.PLATFORM.WEB;
if (!isWeb) {
return;
}
if (event.nativeEvent.key !== 'Enter') {
return;
}
onSubmit();
}}
/> POCScreen.Recording.2024-12-21.at.20.59.15.mp4Test branchWhat specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?Test
Test
What alternative solutions did you explore? (Optional)Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job. |
@ikevin127 Proposals are ready for your review |
This comment was marked as outdated.
This comment was marked as outdated.
Both proposals are suggesting similar solutions when it comes to our main issue with slightly different implementations, both are fixing the issue, but the second proposal is considering another case that is related / in scope. Before I make a decision I want to check with @Expensify/design and / or @luacmartins on whether we should address the related case here. The issue is that, on mWeb, if no item is selected and input is empty and we press
IMO pressing I think we should fix the mWeb case such that we would have the same behaviour on both mWeb and Native. |
Interesting, I think I tend to agree with you. Basically hitting enter on a blank Search query essentially is like resetting the search query back to nothing, aka searching for nothing which would just bring you back to the default home state of Search. |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@luacmartins, @MitchExpensify, @ikevin127 Whoops! This issue is 2 days overdue. Let's get this updated quick! |
We're still awaiting some more input on #53401 (comment) regarding final decision. |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: v9.0.69-4
Reproducible in staging?: Y
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Action Performed:
Navigate to https://staging.new.expensify.com/
Go to search router
Write anything eg. "admin" and clear the search again ( to get the highlight on the first result)
Click search icon on keyboard (enter)
Expected Result:
The highlighted item should open the detail page when clicking enter (Mweb behavior)
Actual Result:
The highlighted search result go to search page rather that the highlighted detail page
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6682275_1733167237785.Screen_Recording_20241202_221823_Expensify.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @ikevin127The text was updated successfully, but these errors were encountered: