You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Server component styles containing >, quotes, or & are HTML-escaped on Next.js 13.5 and 14 #5824
Server components on Next.js 13.5 and 14 can render broken CSS on first load when a style contains a child combinator, a quoted value, or an ampersand.
What happens
styled-components renders server component styles as an inline <style> element. Next.js 13.5 and 14 bundle a React 18.3 canary whose server renderer HTML-escapes text inside <style>, so the server HTML contains, for example:
Browsers read <style> contents as raw text and never decode entities there, so .a > .b is an invalid selector and the rule is dropped. React 19 (Next.js 15 and later) does not escape these characters inside <style>, so newer versions are unaffected.
Minimal repro
// app/page.tsx on next@14, no 'use client'importstyledfrom'styled-components';constList=styled.ul` & > li { color: red; } &::before { content: "list"; }`;exportdefaultfunctionPage(){return(<List><li>should be red</li></List>);}
View the page source: the > and quotes inside the <style> arrive as > and ".
Notes
So far I've confirmed this in the server HTML only; it's worth checking whether a client-side navigation (which renders the style from React's payload instead of HTML) shows the correct styles. ServerStyleSheet output is unaffected because it renders style text through a path the renderer doesn't escape. A fix would render the text the same way for older React versions while still preventing a style value from closing the tag.
Activity
pullfrog commentedon Oct 10, 2026
fix(rsc): keep >, quotes and & as written in server component styles …
quantizor commentedon Nov 25, 2026
Fixed in 6.7