From 2cbe86358f2c5634549707174e0ce2fb64b061a2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 01:37:34 +0000 Subject: [PATCH 1/4] Initial plan From ef90e83644d46cf860ecff20c8fc5a3ebf0839a8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 01:41:59 +0000 Subject: [PATCH 2/4] fix(Link): destructure muted prop to prevent DOM leakage Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com> --- packages/react/src/Link/Link.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react/src/Link/Link.tsx b/packages/react/src/Link/Link.tsx index 1680afb2eb1..65d08ac1424 100644 --- a/packages/react/src/Link/Link.tsx +++ b/packages/react/src/Link/Link.tsx @@ -18,7 +18,7 @@ export const UnwrappedLink = ( props: PolymorphicProps, ref: ForwardedRef, ) => { - const {as: Component = 'a', className, inline, hoverColor, ...restProps} = props + const {as: Component = 'a', className, inline, muted, hoverColor, ...restProps} = props const innerRef = React.useRef>(null) useRefObjectAsForwardedRef(ref, innerRef) @@ -49,7 +49,7 @@ export const UnwrappedLink = ( return ( Date: Fri, 6 Mar 2026 01:49:24 +0000 Subject: [PATCH 3/4] test(Link): assert bare muted attribute is not leaked to DOM Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com> --- packages/react/src/Link/__tests__/Link.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react/src/Link/__tests__/Link.test.tsx b/packages/react/src/Link/__tests__/Link.test.tsx index 56907955641..5a0c04532b8 100644 --- a/packages/react/src/Link/__tests__/Link.test.tsx +++ b/packages/react/src/Link/__tests__/Link.test.tsx @@ -25,6 +25,7 @@ describe('Link', () => { it('respects the "muted" prop', () => { const {container} = render() expect(container.firstChild).toHaveAttribute('data-muted', 'true') + expect(container.firstChild).not.toHaveAttribute('muted') }) it('logs a warning when trying to render invalid "as" prop', () => { From 230d875ed78cb501ad942c997a1568b3504d3b06 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 20:15:53 +0000 Subject: [PATCH 4/4] chore: add changeset for Link muted DOM attribute test Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com> --- .changeset/tame-lions-blend.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tame-lions-blend.md diff --git a/.changeset/tame-lions-blend.md b/.changeset/tame-lions-blend.md new file mode 100644 index 00000000000..c82a7526310 --- /dev/null +++ b/.changeset/tame-lions-blend.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Add test to validate that the `muted` prop is not leaked as a bare DOM attribute on `Link`