-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Strange flicker on refresh #3682
Comments
Apparently you mean that the control key icon flickers on page load (because it changes depending on used OS). @francoischalifour could you please suggest any options to avoid this? |
Hey—this is due to how SSG and therefore Docusaurus (I believe) works. Let me know if I've misunderstood something. Since a Docusaurus website gets generated on a server, we don't know yet what the user's OS will be, and therefore what shortcuts to display. We need to wait to load the page to have this information. Hence, we change this shortcut in an effect. Do you see any alternatives to avoid this flickering? (A safer solution would be to not display shortcuts until we know for sure the browser we're using.) |
Yeah i think that would be best—halt all OS specific things till client side. The same would also have been true for dark mode, light mode stuff (https://joshwcomeau.com/gatsby/dark-mode/). Is this something easily done? I could help with a PR! 🤩 |
@francoischalifour Yes, you are right, as I understand it is also relevant for Gatsby (preview TypeScript website with applied doc search v3 https://ts-with-algolia-search.vercel.app/ faces the same issue).
Well, I think this is a good option. |
If there's a finite set of keys, it's could be possible to render all the keys, but only show one of them, thanks to OS-specific CSS? Not sure how reliable it would be to detect with CSS the OS though... |
CSS variables is also an option, for example same as dark mode, we'd inject a --docsearch-action-key variable in styles at js init time, and use it in a ::after { content: var() } ? (may not work well for docusaurus due to lazy loading the js) |
This fixes a UI flash issue on Windows where the <kbd>⌘</kbd> key shows up right before <kbd>Ctrl</kbd> when using SSG (like Docusaurus). This happened because in these scenarii, the site is generated on a server, and we can't know yet what will the user's OS be. Closes facebook/docusaurus#3682.
Fixed in #3819. |
If you check the notes over at testing-library/testing-library-docs#661 which sent me here.
The rough idea is that the search boxs' keyboard hint flickers on windows.
The text was updated successfully, but these errors were encountered: