Skip to content

fix(next/head): filter invalid html and body tags#94085

Open
bobu-putheeckal wants to merge 1 commit into
vercel:canaryfrom
bobu-putheeckal:codex/head-invalid-elements
Open

fix(next/head): filter invalid html and body tags#94085
bobu-putheeckal wants to merge 1 commit into
vercel:canaryfrom
bobu-putheeckal:codex/head-invalid-elements

Conversation

@bobu-putheeckal
Copy link
Copy Markdown

What?

Warn and filter invalid <html> and <body> children passed to next/head.

Why?

next/head should only manage elements that belong inside the document <head>. Passing document-level tags can produce invalid output instead of a useful development warning.

Closes #20924

How?

  • Filter <html> and <body> React elements during head reduction.
  • Emit a development-only warning with warnOnce.
  • Add a regression fixture and assertion that valid head tags remain while invalid tags are excluded.

Testing

  • Focused dev regression was reported passing by the worker agent.
  • Local rerun was blocked by the isolated dev harness spawning pnpm with ENOENT in this desktop environment after dependency install succeeded.
  • git diff --check
  • prettier --check on touched files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misleading "next-head-count is missing" error for invalid head tags

1 participant