Repository navigation
fix(mui): render Breadcrumb links as MUI Link so styling applies - #7503
adem-loghmari wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 95c3efb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The internal LinkRouter helper spread MUI Link props (sx, underline,
color, variant) onto a bare <span>, so none of them took effect:
breadcrumb links lost flex alignment with their icons, hover underline,
inherited color, and typography size.
Render a real MUI Link via component={LinkFromRouter} so the styling
props are consumed by MUI while client-side routing through `to` is
preserved. Also removes the Link as MuiLink import that had been unused
since the v5 migration.
Closes refinedev#7462
59d42c0 to
95c3efb
Compare
|
Not stale. Rebased onto the latest The bug is still reproducible on current Happy to rebase again or split the test out if that helps review. Closes #7462. |
PR Checklist
What is the current behavior?
In
@refinedev/mui'sBreadcrumb, the internalLinkRouterhelper is typed to accept MUILinkProps(sx,underline,color,variant) but renders them onto a bare native<span>:Because
<span>is a plain DOM element, none of the MUI styling props do anything, they just get dumped onto the node as invalid HTML attributes. Visible impact: breadcrumb links aren't flex-aligned with their icons, get no hover underline, don't inherit color, and don't get the intended typography size.This is a regression from the v5 migration (#6945), commit
5d63adac08. Before that,LinkRouterrendered MUI's actualLink. When the legacy-router plumbing was removed in favor ofuseLink(), the component was rewritten to wrap a<span>but the props were never re-wired to a MUI component. The file still carried an unusedimport { Link as MuiLink } from "@mui/material"from that incomplete change.fixes #7462
What is the new behavior?
LinkRouternow renders a real MUILink, using the router's link component as the underlying element:This matches the existing pattern used by refine's MUI buttons (
component={LinkComponent}), so the styling props (sx,underline,color,variant) are consumed by MUI while client-side routing throughtois preserved. The previously-deadMuiLinkimport is now used.Notes for reviewers
The shared
breadcrumbTestssuite (packages/ui-tests) only checks structure (text, href, icon), so this slipped through untested. I added a MUI-specific test inpackages/mui/src/components/breadcrumb/index.spec.tsxasserting the rendered link carries theMuiLink-rootclass and that no styling props leak into the DOM. Verified the test fails on the old<span>implementation and passes with the fix.