diff --git a/src/components/atoms/core/HTMLElements/inlineTextSemantics/A.jsx b/src/components/atoms/core/HTMLElements/inlineTextSemantics/A.jsx
index fa7759ea..d8b4105d 100644
--- a/src/components/atoms/core/HTMLElements/inlineTextSemantics/A.jsx
+++ b/src/components/atoms/core/HTMLElements/inlineTextSemantics/A.jsx
@@ -16,11 +16,11 @@
import React from "react";
import PropTypes from "prop-types";
import { Link } from "gatsby";
-import styled from "styled-components";
+import styled, { css } from "styled-components";
import { isRouteInternal } from "utils";
-const BaseComponent = styled.a`
+const baseStyles = css`
color: inherit;
cursor: pointer;
text-decoration: none;
@@ -33,10 +33,23 @@ const BaseComponent = styled.a`
}
`;
+const BaseComponent = styled.a`
+ ${baseStyles};
+`;
+
+const BaseGatsbyLink = styled(Link)`
+ ${baseStyles}
+`;
+
/**
* A dynamic and failsafe component which either renders to a base HTML link `` (anchor) or a "Gatsby Link" based on
* the target/URL type, internal or external, passed to the `to` and `href` props.
*
+ * Note: The currently used version of "Gatsby Link" uses the `innerRef` prop to allow `ref` access to the underlying
+ * DOM element (necessary for animations). This legacy behavior is about to change in the future to the
+ * `React.forwardRef` API.
+ * See https://github.com/gatsbyjs/gatsby/pull/9892 for more details.
+ *
* @example Usage
*
* Nord
@@ -44,17 +57,25 @@ const BaseComponent = styled.a`
*
* Blog
* Blog
+ *
+ * const RefLink = React.forwardRef(({children, ...passProps}, ref) => (
+ *
+ * {children}
+ *
+ * );
+ * Blog
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
* @see https://www.gatsbyjs.org/docs/gatsby-link
+ * @see https://github.com/gatsbyjs/gatsby/pull/9892
* @since 0.3.0
*/
-const A = ({ children, href, to, ...passProps }) =>
+const A = ({ children, href, to, linkRef, ...passProps }) =>
isRouteInternal(to) || isRouteInternal(href) ? (
-
+
{children}
-
+
) : (
-
+
{children}
);
@@ -66,4 +87,8 @@ A.propTypes = {
A.defaultProps = { to: "" };
-export default A;
+export default React.forwardRef(({ children, ...passProps }, ref) => (
+
+ {children}
+
+));
diff --git a/test/components/atoms/core/HTMLElements/inlineTextSemantics/__snapshots__/A.test.jsx.snap b/test/components/atoms/core/HTMLElements/inlineTextSemantics/__snapshots__/A.test.jsx.snap
index 0c9d6320..1512930a 100644
--- a/test/components/atoms/core/HTMLElements/inlineTextSemantics/__snapshots__/A.test.jsx.snap
+++ b/test/components/atoms/core/HTMLElements/inlineTextSemantics/__snapshots__/A.test.jsx.snap
@@ -3,7 +3,7 @@
exports[`snapshot renders external URLs with \`href\` prop 1`] = `