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

Navbar menu loses css after navigation from 404 page #3486

Open
Tracked by #2600
arno-fukuda opened this issue Oct 18, 2024 · 2 comments
Open
Tracked by #2600

Navbar menu loses css after navigation from 404 page #3486

arno-fukuda opened this issue Oct 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@arno-fukuda
Copy link
Contributor

Describe the bug A clear and concise description of what the bug is.
Repro video:
https://github.com/user-attachments/assets/0dd94563-4b67-4e4d-b985-008ae1569f39

To Reproduce Steps to reproduce the behavior:

  1. create a custom 404.jsx file
  2. navigate to a 404 page like /doesntexist
  3. Use an anchor element on the 404 page to navigate to an existing page, like /
  4. See that the modal of menus in the navbar lose their padding css.
Screenshot 2024-10-18 at 17 19 33

Expected behavior
Keep CSS

@arno-fukuda arno-fukuda added the bug Something isn't working label Oct 18, 2024
@dimaMachina
Copy link
Collaborator

it happens only for i18n websites for some reasons, because dir attribute is not set on <html> element after navigating with <NextLink> from 404 page

image

previously this script set dir on <html>, but while navigating with <NextLink> from 404 it's not reexecuted

<script
dangerouslySetInnerHTML={{
__html: `document.documentElement.setAttribute('dir','${dir}')`
}}
/>

way to fix:

  1. use <a> instead of <NextLink> in 404 page
  2. manually hardcode dir="ltr" in _document.jsx

@dimaMachina dimaMachina mentioned this issue Oct 18, 2024
51 tasks
@arno-fukuda
Copy link
Contributor Author

<Html dir="ltr"> workaround did the trick, thank you !

Repository owner deleted a comment Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants