Closed greatwitenorth closed 1 year ago
Hey @greatwitenorth, thanks for the report!
You're correct; <PrismicLink>
was updated in v2.4.0 to automatically open external URLs in new windows. In retrospect, this was a mistake for the exact reason you explained.
The change has been revered as of v2.5.2. target="_blank"
is now only automatically set if "Open in new tab" is checked.
You can install the latest version of @prismicio/react
with the following command:
npm install --save @prismicio/react@latest
If this doesn't fix the issue, please let me know and I'll take another look at it. Thanks! 🙂
Versions
Reproduction
Minimum reproduction can be found here: https://github.com/greatwitenorth/roadmap-link-issue
repo is
roadmap-link-issue
At some point between v2.0.3 (the last known version which was working for me) and v2.5.1 it looks like a decision was made to open external links in a new window by default if no target has been specified. This produces undesirable behaviour, since when a rich text field contains a link, no target is generally specified if you want the link to open in the same window.
It seems like this block of code might be contributing to the problem: https://github.com/prismicio/prismic-react/blob/5b49ad5f9b624ed843c44f28dc3063ae8cde4bd0/src/PrismicLink.tsx#L187-L194
Steps to reproduce
off
.PrismicRichText
componentWhat is expected?
What is actually happening?