Repository navigation
fix(blocks): render CoreButton links without Link's legacyBehavior - #2716
Merged
Merged
Conversation
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
marked this pull request as ready for review
November 2, 2026 21:29
Contributor
There was a problem hiding this comment.
🟢 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
Linkand 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
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
legacyBehaviordeprecation 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.