-
Notifications
You must be signed in to change notification settings - Fork 120
[Woo POS][Product Search] Pre search UI – Show recent searches #15511
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
[Woo POS][Product Search] Pre search UI – Show recent searches #15511
Conversation
Coupon search isn’t actually supported, but there’s no reason to hardcode 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.
Pull Request Overview
This PR adds a pre-search UI to the POS product search, displaying a list of recent searches when the search field is activated without any input. Key changes include:
- Introducing a FocusState and enhancing the search field with a clear/back button.
- Adding and integrating the POSRecentSearchesView to show saved searches in a responsive grid layout.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| WooCommerce/Classes/POS/Presentation/ItemListView.swift | Updated search field to manage focus and display recent searches when empty. |
| WooCommerce/Classes/POS/Presentation/Item Search/POSRecentSearchesView.swift | Added a new view for presenting recent searches using a LazyVGrid and a dedicated RecentSearchCard UI. |
Files not reviewed (1)
- WooCommerce/WooCommerce.xcodeproj/project.pbxproj: Language not supported
WooCommerce/Classes/POS/Presentation/Item Search/POSRecentSearchesView.swift
Outdated
Show resolved
Hide resolved
|
Our empty views have padding for the floating button, and it's retained when the keyboard appears. It's a minor thing but we need to create a task for it. Simulator.Screen.Recording.-.iPad.Air.11-inch.M2.-.2025-04-17.at.13.04.05.mp4 |
staskus
left a comment
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.
The functionality works well, accessibility features as well. Also checked how it looks for VoiceOver with accessibility labels. think the list and recent searches view already works well. For further improvements likely worth adding additional hint on the search field.
| case .empty: | ||
| emptyView | ||
| if isSearchFieldFocused && searchTerm.isEmpty { | ||
| POSRecentSearchesView( |
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.
Nice that we can use a different recent searches view, but continue using the existing list for the results.
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'm not sure whether we'll keep doing that, but yeah, it's pretty flexible 😊
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Good spot. I think it's better to keep the buttons hidden by the keyboard than to start to float them to the top. |

Part of WOOMOB-314
Description
This PR adds a pre-search view to the search, so when you focus the search field without a search term, we show previous searches.
Tapping a search populates the search field and performs the search.
I've also added a
<button to leave search mode. The button is currently a little tricky to tap but will be improved when I do more UI polish.There's some copy pasted code relating to image sizes from the products cards. I'm going to factor that out in another PR tomorrow but it just made this one confusing to do it here, and it's already copied to various places.
Steps to reproduce
Enable the
searchProductsInPOSflagTesting information
I took some care with the adaptivity and accessibility in this PR, but it'll change over the coming PRs when we add popular products, so don't feel you need to test that in detail just now if you don't want to. I have tested it.
One accessibility improvement I plan to explore is hiding the image at larger dynamic type sizes, as we do on the cart. I'll do that right at the end though, it may not feel right with products in this list as it's pretty important for identifying them.
I've tested on an iPad Air running iOS 17.7.3 and a simulator running iOS 18.4
Screenshots
recent.searches.mp4
RELEASE-NOTES.txtif necessary.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: