fix(mui): render Breadcrumb links as MUI Link so styling applies - #7503
Open
adem-loghmari wants to merge 1 commit into
Open
fix(mui): render Breadcrumb links as MUI Link so styling applies#7503adem-loghmari wants to merge 1 commit into
adem-loghmari wants to merge 1 commit into
Conversation
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
🦋 Changeset detectedLatest commit: 59d42c0 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 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.
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.