Skip to content

Commit

Permalink
fix(Link): Do not ignore onMouseEnter prop with absolute href
Browse files Browse the repository at this point in the history
Fixes #22733
  • Loading branch information
ericmatthys committed Dec 1, 2021
1 parent 32ac918 commit 4bdba97
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/next/client/link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,12 @@ function Link(props: React.PropsWithChildren<LinkProps>) {
}

childProps.onMouseEnter = (e: React.MouseEvent) => {
if (!isLocalURL(href)) return
if (child.props && typeof child.props.onMouseEnter === 'function') {
child.props.onMouseEnter(e)
}
prefetch(router, href, as, { priority: true })
if (isLocalURL(href)) {
prefetch(router, href, as, { priority: true })
}
}

// If child is an <a> tag and doesn't have a href attribute, or if the 'passHref' property is
Expand Down

0 comments on commit 4bdba97

Please sign in to comment.