react-spectrum
react-spectrum copied to clipboard
`useHref` passed to `RouterProvider` not respected for synthetic links
Provide a general summary of the issue here
The useHref function passed to RouterProvider is not being called for synthetic links.
In our Next.js app this results in the data-href attribute missing the base path. Meaning when using CMD + left click to open the link in a new tab the URL is missing the base path.
Looks like it was forgotten in https://github.com/adobe/react-spectrum/pull/5864
๐ค Expected Behavior?
The base path is prepended to the data-href attribute
๐ฏ Current Behavior
Using CMD + left click to open a synthetic link in a new tab results in an invalid URL.
๐ Possible Solution
Use useHref when setting the data-href attribute.
๐ฆ Context
No response
๐ฅ๏ธ Steps to Reproduce
- visit https://codesandbox.io/p/sandbox/gallant-currying-l8p7xc?file=%2Fsrc%2FApp.js
CMD+ left click to open the link in a new tab- see that the base path is missing
Version
What browsers are you seeing the problem on?
Firefox, Chrome, Safari, Microsoft Edge
If other, please specify.
No response
What operating system are you using?
MacOS, Windows
๐งข Your Company/Team
No response
๐ท Tracking Issue
No response