Skip to content

Commit

Permalink
fix(Link): Do not pass through hoverColor prop in Link (#5319)
Browse files Browse the repository at this point in the history
  • Loading branch information
hussam-i-am authored Nov 20, 2024
1 parent 56ff1c0 commit 37c4e97
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-garlics-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": minor
---

Do not pass through hoverColor prop into DOM element
4 changes: 3 additions & 1 deletion packages/react/src/Link/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type StyledLinkProps = {
inline?: boolean
} & SxProp

const Link = forwardRef(({as: Component = 'a', className, inline, underline, ...props}, forwardedRef) => {
const Link = forwardRef(({as: Component = 'a', className, inline, underline, hoverColor, ...props}, forwardedRef) => {
const innerRef = React.useRef<HTMLAnchorElement>(null)
useRefObjectAsForwardedRef(forwardedRef, innerRef)

Expand Down Expand Up @@ -53,6 +53,7 @@ const Link = forwardRef(({as: Component = 'a', className, inline, underline, ...
data-muted={props.muted}
data-inline={inline}
data-underline={underline}
data-hover-color={hoverColor}
{...props}
// @ts-ignore shh
ref={innerRef}
Expand All @@ -66,6 +67,7 @@ const Link = forwardRef(({as: Component = 'a', className, inline, underline, ...
data-muted={props.muted}
data-inline={inline}
data-underline={underline}
data-hover-color={hoverColor}
{...props}
// @ts-ignore shh
ref={innerRef}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports[`Link passes href down to link element 1`] = `
exports[`Link respects hoverColor prop 1`] = `
<a
className="Link"
hoverColor="accent.fg"
data-hover-color="accent.fg"
/>
`;

Expand Down

0 comments on commit 37c4e97

Please sign in to comment.