Skip to content
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

Conversation

SRangineni88
Copy link
Contributor

@SRangineni88 SRangineni88 commented Jan 21, 2025

Jira ticket

L3-5101

Screenshots

Before After
Paste Before Image Paste After Image

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.

  • Additions, Changes, and Removals

Acceptance Test (how to verify the PR)

  • Add step by step instructions on how to verify the change

Regression Test

  • (Optional) Add verification steps to make sure this PR doesn't break old functionality

Evidence of testing

  • Post logs, screenshots, etc

Things to look for during review

  • PR title should correctly describe the most significant type of commit. I.e. feat(scope): ... if a minor release should be triggered.
  • All commit messages follow convention and are appropriate for the changes
  • All references to phillips class prefix are using the prefix variable
  • All major areas have a data-testid attribute.
  • Document all props with jsdoc comments
  • All strings should be translatable.
  • Unit tests should be written and should have a coverage of 90% or higher in all areas.

New Components

  • Are there any accessibility considerations that need to be taken into account and tested?
  • Default story called "Playground" should be created for all new components
  • Create a jsdoc comment that has an Overview section and a link to the Figma design for the component
  • Export the component and its typescript type from the index.ts file
  • Import the component scss file into the componentStyles.scss file.

Copy link

netlify bot commented Jan 21, 2025

Deploy Preview for phillips-seldon ready!

Name Link
🔨 Latest commit aa60eb4
🔍 Latest deploy log https://app.netlify.com/sites/phillips-seldon/deploys/678faa4a458d28000852823f
😎 Deploy Preview https://deploy-preview-478--phillips-seldon.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@SRangineni88 SRangineni88 changed the title Fix/l3 5101 search bar flashing and removes typed search Fix(search):l3 5101 search bar flashing and removes typed search Jan 21, 2025
@SRangineni88 SRangineni88 changed the title Fix(search):l3 5101 search bar flashing and removes typed search fix(search):l3 5101 search bar flashing and removes typed search Jan 21, 2025
@SRangineni88 SRangineni88 changed the title fix(search):l3 5101 search bar flashing and removes typed search fix(search): L3-5101 search bar flashing and removes typed search Jan 21, 2025
@@ -48,7 +47,7 @@ const SearchResults = ({
<Link
href={result.url}
onKeyDown={onKeyDown}
onClick={() => closeSearch(false)}
// onClick={() => closeSearch(false)}
Copy link
Contributor

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)}
Copy link
Collaborator

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);
Copy link
Collaborator

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.

Copy link
Collaborator

@davidicus davidicus left a 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

Copy link
Collaborator

@adietrich3074 adietrich3074 left a 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,
Copy link
Contributor

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

Copy link
Contributor

@scottdickerson scottdickerson left a 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.

@scottdickerson
Copy link
Contributor

Remix.Search.Behavior.mov

@scottdickerson scottdickerson deleted the fix/L3-5101-Search-Bar-Flashing-and-Removes-Typed-Search branch January 30, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants