Skip to content

fix(blocks): render CoreButton links without Link's legacyBehavior - #2716

Merged
josephfusco merged 2 commits into
canaryfrom
fix/blocks-core-button-link
Nov 3, 2026
Merged

josephfusco merged 2 commits into
canaryfrom
fix/blocks-core-button-link

Conversation

@josephfusco

Copy link
Copy Markdown
Member

The rendered markup is byte-for-byte the same as before. In the block-support example in dev mode, the published 7.1.0 logs Next.js's legacyBehavior deprecation warning for every button with a URL, in the browser and on the server, and this build logs none.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Assisting with the change, comparing the rendered markup before and after, and checking it in the block-support example.

Next.js deprecated legacyBehavior and will remove it in a future major,
which would break buttons that have a URL. Link now gets the anchor's
attributes directly; the rendered markup is unchanged.
@josephfusco josephfusco added [Type] Bug An existing feature is broken [Area] Blocks Issues for the @faustwp/blocks package labels Nov 2, 2026
@josephfusco
josephfusco marked this pull request as ready for review November 2, 2026 21:29
@josephfusco
josephfusco requested review from a team and colinmurphy as code owners November 2, 2026 21:29
@josephfusco
josephfusco requested a balanced review from Copilot November 3, 2026 10:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the CoreButton link-rendering update.

No open issues 🎉

What changed in this PR

Updates CoreButton to use Next.js Link without deprecated legacyBehavior, preserving the single-anchor structure and existing link attributes.

Changes:

  • Moves anchor attributes onto Link and removes the explicit <a> child.
  • Adds a regression test for link attributes and single-anchor rendering.
File Description
packages/​blocks/​tests/​blocks/​CoreButton.test.tsx Verifies URL, target, relation, CSS class, and single-anchor output.
packages/​blocks/​src/​blocks/​CoreButton.tsx Replaces legacy link rendering with direct Link attributes.

Review effort: Balanced

@josephfusco
josephfusco merged commit 7a511e5 into canary Nov 3, 2026
13 checks passed
@josephfusco
josephfusco deleted the fix/blocks-core-button-link branch November 3, 2026 16:18
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Blocks Issues for the @faustwp/blocks package [Type] Bug An existing feature is broken

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants