[ ] Chore (a non-breaking change which is related to package maintenance)
[x] Bug fix (a non-breaking change which fixes an issue)
[ ] New feature (a non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Description
This PR changes <PrismicLink> such that target="_blank" is only automatically set when a Link field's "Open in new tab" checkbox is checked.
Before this PR, <PrismicLink> would set target="_blank" when "Open in new tab" was checked or when the URL was external (i.e. started with https://).
Automatically opening external URLs in new windows was originally introduced as a convenience. However, this meant the "Open in new tab" checkbox was ignored in some cases; if the checkbox was purposely unchecked, the link would still open in a new window. This is considered a bug.
rel="noopener noreferrer" will continue to be set automatically if target="_blank" is set.
Fixes #171
Checklist:
[ ] My change requires an update to the official documentation.
[x] All TSDoc comments are up-to-date and new ones have been added where necessary.
Types of changes
Description
This PR changes
<PrismicLink>
such thattarget="_blank"
is only automatically set when a Link field's "Open in new tab" checkbox is checked.Before this PR,
<PrismicLink>
would settarget="_blank"
when "Open in new tab" was checked or when the URL was external (i.e. started withhttps://
).Automatically opening external URLs in new windows was originally introduced as a convenience. However, this meant the "Open in new tab" checkbox was ignored in some cases; if the checkbox was purposely unchecked, the link would still open in a new window. This is considered a bug.
rel="noopener noreferrer"
will continue to be set automatically iftarget="_blank"
is set.Fixes #171
Checklist:
🐛