-
Notifications
You must be signed in to change notification settings - Fork 43
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(clear-search): Fixed Clear Search When Someone Clicks Out of The Page. #18
Conversation
Hi @ecurrencyhodler, |
Okay let's get a code review. GJ. |
@MirzaHanan This breaks the search on the People Tab |
We just merged a fix. Can you pull from master again? Also you have a read.me conflicting file. |
4cf5f3c
to
3c2fbdf
Compare
@ecurrencyhodler Please check it. |
…age and other routes
Great job! Okay we need a code review. |
Tested and paid. LGTM! |
Actually mirza there was one scenario where this wasn't addressed. I recorded it here. It looks like when I search inside a profile and go to people's page, the search is saved but hidden. Can you do a follow up PR so that the search is completely cleared? Screen.Recording.2024-01-28.at.8.51.32.PM.mov |
Hi @ecurrencyhodler, |
Problem:
The application retains the search term in the UI state when users navigate away from the profile page to either the
people page
or thebounty homepage
and otherroutes
. This behavior is inconsistent with typical user expectations where a search term should be cleared upon navigating to a different page.Expected Behavior:
When a user navigates away from the profile page, the search term entered should be automatically cleared. This ensures that when the user visits the
people
page or thebounty homepage
and otherall routes
, they are presented with a fresh state, unfiltered by their previous search.Issue ticket number and link:
Solution:
The solution involves adding an event listener in the
UiStore
class constructor to detect click events on the document. If a click event occurs outside the search input (.search-input-wrapper
), theclearSearchText
method is called to reset thesearchText
state to an empty string.Changes:
UiStore
class constructor to include a document click event listener.handleDocumentClick
, a method to check the target of click events and determine if they occur outside the search input area.clearSearchText
method to reset the search text.Evidence:
Please see the attached video as evidence.
Testing: