To be able to have all the browser native features (open in new tab, copy link…) I want to use reach/tabs with Link from react-router. So far I'm failing, and I don't really know why 😕
I want to have a tab system connected to the router.
https://codesandbox.io/s/small-cdn-dr1lh?file=/src/App.tsx
Click on one link/tab =>

I'm using react-router:4.3.1, all the details are in the repro example 😉
| Software | Name(s) | Version |
| ---------------- | ------- | ------- |
| Reach Package | tabs | 0.10.5 |
| React | | 16.12.0 |
| Browser | chrome | latest |
| Assistive tech | | |
| Node | | |
| npm/yarn | | |
| Operating System | | |
Hi,
Here what i found after some investigation:
ownRef.current.focus() without checking if the target is a host element with a focus method (aka HTMLElement)ref property but the react-router Link component uses innerRefHow can we improve this part?
focus method?<Tab as={Link} asRef="innerRef" to="/three">)In the mean time, (not tested) i guess you can wrap the Link into a CustomLink to forward the ref prop to the react-router innerRef property.
I think i can provide a PR when we'll have chosen an option.
@ghostd Thanks for your investigation! I've tried quickly on the sandbox to wrap the Link, works! (not totally perfect in term of typesafety, but could be worst)
const CustomLink = React.forwardRef<Link, LinkProps>((props, ref) => <Link {...props} innerRef={ref as any} />)
And if you are using styled components to customize tabs appearance, don't forget to use the forwardedAs prop instead of as 😉
Most helpful comment
Hi,
Here what i found after some investigation:
ownRef.current.focus()without checking if the target is a host element with afocusmethod (akaHTMLElement)refproperty but the react-routerLinkcomponent usesinnerRefHow can we improve this part?
focusmethod?<Tab as={Link} asRef="innerRef" to="/three">)In the mean time, (not tested) i guess you can wrap the
Linkinto aCustomLinkto forward therefprop to the react-routerinnerRefproperty.I think i can provide a PR when we'll have chosen an option.