-
Notifications
You must be signed in to change notification settings - Fork 0
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(search): L3-5101 search bar flashing and removes typed search #478
fix(search): L3-5101 search bar flashing and removes typed search #478
Conversation
✅ Deploy Preview for phillips-seldon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -48,7 +47,7 @@ const SearchResults = ({ | |||
<Link | |||
href={result.url} | |||
onKeyDown={onKeyDown} | |||
onClick={() => closeSearch(false)} | |||
// onClick={() => closeSearch(false)} |
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.
Do we want to remove this completely? Looks to only be commented out here.
Also, how is this closed now, then? I see we are controlled the opacity now but does the search bar clear when a link is clicked or does it just stay open?
@@ -203,7 +201,6 @@ const Search = ({ | |||
> | |||
<li key="viewAllSearchResults" className={`${baseClassName}__result`}> | |||
<Link | |||
onClick={() => showSearch(false)} |
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 think this is closing that search bar when clicking on one of the links in the search dropdown. I am not sure we want to remove this.
@@ -96,7 +95,6 @@ const Search = ({ | |||
e.preventDefault(); | |||
if (value && value.length > 2) { | |||
const allResultsLink = encodeURLSearchParams(getAllResultsLink(value)); | |||
showSearch(false); |
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.
same comment about this. I would think we would want the search to close when we hit enter.
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 would like @adietrich3074 to review before letting this go as he had added some of this to fix other bugs in phillips-public
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 if the removal of all the close search functionality is the solution for this. The close search functionality was added to handle bugs where a user selects a search result, navigates to the page, and then hits the back button, the search will remain open and show broken on the page. I think this issue can be solved with the solution we implemented in remix which is to debounce the results. This allows time before the search gets sent and wait for the user to finish typing as opposed to making a call to the search api every time a character is entered. I believe these repeated calls with the results returning quickly is the cause of the flashing. There is an example of how the debouncing is done in the remix project in Header.tsx
@@ -103,8 +103,8 @@ $snwHeaderLink: 'snwHeaderLink'; | |||
$snwFlyoutLink: 'snwFlyoutLink'; | |||
$snwHeadingHero1: 'snwHeadingHero1'; | |||
$snwHeadingHero2: 'snwHeadingHero2'; | |||
$text-tokens: $button, $link, $email, $label, $badge, $blockquote, $heading1, $heading2, $heading3, $heading4, $heading5, | |||
$title1, $title2, $title3, $title4, $body1, $body2, $body3, $string1, $string2, $string3, $snwFlyoutLink, | |||
$text-tokens: $button, $link, $email, $label, $badge, $blockquote, $heading1, $heading2, $heading3, $heading4, |
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 we undo this change? I'm guessing something about your prettier config isn't matching our repo one
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 don't think this should be fixed in seldon. If you look at the Remix use of the Search widget in production: https://www.phillips.com/about. I don't see the behavior that is referenced in the defect, which makes me think that there must be some approach that can be mirrored in Phillips-Public to fix this. @adietrich3074 can help out there I think.
Remix.Search.Behavior.mov |
Jira ticket
L3-5101
Screenshots
Summary
Search Bar Flashing and Removes Typed Search
Change List (describe the changes made to the files)
Added css transition on search to minimize the flickering
Removed logic to close search immediately on key press or on clicking the search result link.
Acceptance Test (how to verify the PR)
Regression Test
Evidence of testing
Things to look for during review
feat(scope): ...
if aminor
release should be triggered.phillips
class prefix are using the prefix variabledata-testid
attribute.New Components
index.ts
filecomponentStyles.scss
file.