Is your feature request related to a problem? Please describe.
As JSS exports a shared Link component it should accept a ref prop in order to access their DOM nodes and for managing focus, selection, or animations.
[...] it can be useful for some kinds of components, especially in reusable component libraries.
Set up the Link component using React.forwardRef to allow refs to be passed to the underlying anchor. This change would have to be made in nextjs and react jss packages.
Not having a ref prop means consumers don't have access to the underlying DOM components.
Unsure if you would be happy to release it as a minor version given this note in the React docs:
Note for component library maintainers
When you start using forwardRef in a component library, you should treat it as a breaking change and release a new major version of your library. This is because your library likely has an observably different behavior (such as what refs get assigned to, and what types are exported), and this can break apps and other libraries that depend on the old behavior.
Additionally, I assume there will be other components that would benefit from having a ref prop.
Is your feature request related to a problem? Please describe.
As JSS exports a shared
Link
component it should accept aref
prop in order to access their DOM nodes and for managing focus, selection, or animations.Source: https://reactjs.org/docs/forwarding-refs.html
Describe the solution you'd like
Set up the Link component using
React.forwardRef
to allow refs to be passed to the underlying anchor. This change would have to be made in nextjs and react jss packages.https://github.com/Sitecore/jss/blob/v20.0.3/packages/sitecore-jss-nextjs/src/components/Link.tsx#L20 https://github.com/Sitecore/jss/blob/v20.0.3/packages/sitecore-jss-react/src/components/Link.tsx#L41
Additional information
Not having a
ref
prop means consumers don't have access to the underlying DOM components.Unsure if you would be happy to release it as a minor version given this note in the React docs:
Additionally, I assume there will be other components that would benefit from having a
ref
prop.