Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created ResultLink to handle the opening of result links in new tabs #178

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

lamemakes
Copy link
Contributor

@lamemakes lamemakes commented Mar 10, 2024

Closes #174. Adds the ability of being able to open result links in a new tab. This is done via a new settings store & component to handle the logic of the store. Adds target="_blank" rel="noopener noreferrer" to the anchor element.

Screenshots

Updates to settings
Screenshot from 2024-03-10 18-00-35

The result being tested
Screenshot from 2024-03-10 18-02-29

Open in new tab disabled
Screenshot from 2024-03-10 18-03-34

Open in new tab enabled
Screenshot from 2024-03-10 18-02-10

@lamemakes lamemakes changed the title [WIP] Created ResultLink to handle the opening of result links in new tabs Created ResultLink to handle the opening of result links in new tabs Mar 11, 2024
@lamemakes lamemakes marked this pull request as ready for review March 11, 2024 13:55
@lamemakes
Copy link
Contributor Author

Tested for wiki, stackoverflow & thesaurus and all looks good

Copy link
Member

@mikkeldenker mikkeldenker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thank you! I think we should only open links that point out to other sites in new tabs, but other than that it works exactly as expected. Should be ready to merge after the minor change

@@ -14,12 +15,12 @@
<div class="inline-block space-x-1">
{#each meaning.similar as similar}
<div class="float-left inline [&:not(:last-child)]:after:content-[',']">
<a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should still be a regular anchor tag as the link points to another page on stract

{title}
use:improvements={resultIndex}
target={$resultsInNewTab ? '_blank' : null}
rel={$resultsInNewTab ? 'noopener noreferrer' : null}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we only need to add noopener as referrer is already handled for all links by a meta tag inside frontend/src/app.html

@mikkeldenker mikkeldenker merged commit 7bca42f into StractOrg:main Mar 13, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open Results in New Tab
2 participants