-
Couldn't load subscription status.
- Fork 10.9k
fix: remove deprecated Next.js Link props legacyBehavior and passHref #24686
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
base: main
Are you sure you want to change the base?
fix: remove deprecated Next.js Link props legacyBehavior and passHref #24686
Conversation
|
@KartikLabhshetwar is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8 issues found across 9 files
Prompt for AI agents (all 8 issues)
Understand the root cause of the following 8 issues and fix them.
<file name="packages/ui/components/list/List.tsx">
<violation number="1" location="packages/ui/components/list/List.tsx:54">
Link items no longer receive their onClick/ARIA/data props because only className and data-testid are passed to <Link/>. Please spread the accumulated props onto the Link to preserve existing behavior.</violation>
</file>
<file name="apps/web/modules/auth/forgot-password/[id]/forgot-password-single-view.tsx">
<violation number="1" location="apps/web/modules/auth/forgot-password/[id]/forgot-password-single-view.tsx:48">
Dropping legacyBehavior means Link now renders an anchor, so this button becomes nested inside <a>, which is invalid HTML and breaks accessibility. Render the link content as an anchor (or refactor to avoid nested interactive controls).</violation>
</file>
<file name="apps/web/components/apps/zapier/Setup.tsx">
<violation number="1" location="apps/web/components/apps/zapier/Setup.tsx:141">
The new Link API wraps children in an anchor, so this now produces `<a><button>…</button></a>`. The Button component doesn’t pick up `href`, leaving the inner element as `<button>`, which violates HTML semantics and accessibility. Please ensure the child renders the anchor itself (e.g., pass `href` to Button or restore the legacy behavior).</violation>
</file>
<file name="apps/web/components/apps/make/Setup.tsx">
<violation number="1" location="apps/web/components/apps/make/Setup.tsx:137">
Dropping legacyBehavior means Link now renders an <a>, so this change nests our Button’s <button> inside an anchor. That’s invalid/interactive markup and causes accessibility issues; convert the styling to use Button `asChild` (or otherwise avoid wrapping a <button> in <a>).</violation>
</file>
<file name="packages/ui/components/button/Button.tsx">
<violation number="1" location="packages/ui/components/button/Button.tsx:336">
forwardRef is now ignored when href is provided, so callers cannot obtain the anchor/button element through the ref in link mode. Please pass forwardedRef down to the Link component to keep ref support intact.</violation>
<violation number="2" location="packages/ui/components/button/Button.tsx:340">
The Link branch no longer forwards pass-through props (target, rel, aria-*, data-*) to the rendered anchor, so consumers lose those attributes compared with the previous implementation. Please spread the elementProps onto the Link to preserve existing behavior.</violation>
</file>
<file name="packages/ui/components/form/step/Stepper.tsx">
<violation number="1" location="packages/ui/components/form/step/Stepper.tsx:35">
Moving `aria-current` from the anchor to the inner span removes the current-step announcement for assistive tech. Please keep `aria-current="step"` on the Link element so the active step remains accessible.</violation>
</file>
<file name="packages/app-store/_components/AppNotInstalledMessage.tsx">
<violation number="1" location="packages/app-store/_components/AppNotInstalledMessage.tsx:20">
Dropping legacyBehavior here makes Link render an <a> around Button, but Button (without an href prop) still creates a real <button>. That gives an <a><button>…</button></a> nesting, which React flags and can break navigation/accessibility. Pass the href directly to Button instead so it renders the Link internally.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
apps/web/modules/auth/forgot-password/[id]/forgot-password-single-view.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KartikLabhshetwar, thank you for your contribution! There's some cubic comments that needs to be addressed.. do you want to move with them?
I am working on it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 9 files
|
SHOULD I FIX THIS? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 9 files
Prompt for AI agents (all 1 issues)
Understand the root cause of the following 1 issues and fix them.
<file name="packages/ui/components/button/Button.tsx">
<violation number="1" location="packages/ui/components/button/Button.tsx:343">
Forward the computed disabled flag to the Link so link-style buttons still receive the `[disabled]` attribute (required for the existing disabled:* styling when loading sets disabled implicitly).</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| href={props.href} | ||
| shallow={shallow && shallow} | ||
| className={elementProps.className} | ||
| onClick={elementProps.onClick}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forward the computed disabled flag to the Link so link-style buttons still receive the [disabled] attribute (required for the existing disabled:* styling when loading sets disabled implicitly).
Prompt for AI agents
Address the following comment on packages/ui/components/button/Button.tsx at line 343:
<comment>Forward the computed disabled flag to the Link so link-style buttons still receive the `[disabled]` attribute (required for the existing disabled:* styling when loading sets disabled implicitly).</comment>
<file context>
@@ -333,8 +333,15 @@ export const Button = forwardRef<HTMLAnchorElement | HTMLButtonElement, ButtonPr
+ href={props.href}
+ shallow={shallow && shallow}
+ className={elementProps.className}
+ onClick={elementProps.onClick}>
+ {elementContent}
</Link>
</file context>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 3 files
What does this PR do?
Visual Demo (For contributors especially)
Image Demo (if applicable):
before:

after:
no error visible
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
Summary by cubic
Removed deprecated Next.js Link props (legacyBehavior, passHref) and updated components to the current Link API. This resolves deprecation warnings (CAL-6638, #24685) without changing UI or behavior.