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

Search style jumps #37311

Closed
ojeytonwilliams opened this issue Oct 15, 2019 · 3 comments · Fixed by #37349
Closed

Search style jumps #37311

ojeytonwilliams opened this issue Oct 15, 2019 · 3 comments · Fixed by #37349
Assignees
Labels
platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.

Comments

@ojeytonwilliams
Copy link
Contributor

Describe the bug
When you reload a page two style issues appear.

  • The placeholder text moves slightly once the page has fully loaded.
  • The search hits are briefly bold

To Reproduce
Steps to reproduce the behavior:

  1. Go to www.freecodecamp.dev (or any page with search)
  2. Reload
  3. See the placeholder text move
  4. Click on the search bar
  5. Type anything
  6. See the result appear briefly as bold, then change to a normal weight

Expected behavior
The page should start with the styles it ends up getting.

Screenshots
SearchFOUC

@ojeytonwilliams ojeytonwilliams added type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. labels Oct 15, 2019
@ojeytonwilliams ojeytonwilliams self-assigned this Oct 15, 2019
@GabCostaSilva
Copy link

Hey, I wanna help with it. Where can I find the code for it? (First time contributing)

@ojeytonwilliams
Copy link
Contributor Author

@GabCostaSilva I'm not 100% sure where the problem is, but the SearchBar, SearchHits and SearchSuggestion components are all involved to some degree. Somehow the SearchSuggestions are not getting the right classes when first rendered I think.

I'm planning to take a closer look myself, tomorrow, but you're welcome to submit a PR/share any insight. As you wish!

@ojeytonwilliams
Copy link
Contributor Author

It turns out it wasn't anything to do with those components. The problem is that the Lato-300 font doesn't get loaded until it's needed - in this case when the search results appear. That causes a brief flash of Arial and that's the cause of the problem.

I'm going to look into pre-loading the fonts and clear this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants