-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
<ViewTransitions /> Renders the contents of <noscript> tags after initial navigation #7969
Comments
@Xetera as a quick fix you might try adding data-astro-transition-persist="someId" to the noscript tag |
Interesting! I'm assuming If you're looking to help with a PR, I'd suggest updating our script to remove |
This is due to using DOMParser which apparently parses noscript children as markup. See https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString Thinking about what can be done about this... |
Using |
@martrapp you want to give that a try? I had played around with it myself but I didn't think it was working how I expected. |
What version of
astro
are you using?2.10.1
Are you using an SSR adapter? If so, which one?
None
What package manager are you using?
npm
What operating system are you using?
Linux, MacOS
What browser are you using?
Chrome, Edge, Firefox, Safari
Describe the Bug
When using
<ViewTransitions />
with no additional configuration, the initial page transition triggers the<noscript>
contents to be displayed as if javascript is disabled. This behavior is consistent no matter what part of the page the view transitions or the<noscript>
elements are placed in the shared layout.I've done some investigation and the problem seems to be happening after the body is replaced with the response from the server:
astro/packages/astro/components/ViewTransitions.astro
Lines 119 to 125 in 9ad0d32
On the line before where the head is replaced, the
<noscript>
rules don't apply to the page being navigated away from, but when the body is replaced with the new page's response. They magically jump out.I thought this could be a chromium bug with view transitions since it almost feels impossible for astro to be responsible for what happening without accidentally pulling out
<noscript>
children out and rendering it directly. But this happens on Firefox and Safari with fallback rules too since the cause of the problem isn't related to view transitions at all.What's the expected result?
Contents of noscript tags should not be rendered with javascript enabled
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-uxtpsm?file=src%2Fcomponents%2Flayout.astro
Participation
The text was updated successfully, but these errors were encountered: