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

Update sidenav-links marked as external to open in a new tab #645

Merged
merged 1 commit into from
Nov 6, 2023

Conversation

brentswisher
Copy link
Contributor

External sidenav links now will open in a new tab matching the documentation, as well as having rel="noopener" added to the link.

This change: (check at least one)

  • Adds a new feature
  • Fixes a bug
  • Improves maintainability
  • Improves documentation
  • Is a release activity

Is this a breaking change? (check one)

  • Yes
  • No

Is the: (complete all)

  • Title of this pull request clear, concise, and indicative of the issue number it addresses, if any?
  • Test suite(s) passing?
  • Code coverage maximal?
  • Changeset added?
  • Component status page up to date?

What does this change address?
Closes #538

How does this change work?
If a PharosSidenavLink is created with the external option, the link will be rendered with target="_blank" and rel="noopener". If for some reason someone manually specified a target with external it will still respect the target that was set.

Additional context

  • I opted against adding rel="nofollow" as mentioned in the issue because I think there are cases when that wouldn't be the desired value.
  • I also updated storybook to show that target="_blank" no longer needs to be manually added.

External links now will open in a new tab matching the documentation,
as well as having rel="noopener" added to the link. If a target is
manually specified it will be used instead of the "_blank" set by
it being external.
Copy link

changeset-bot bot commented Nov 3, 2023

🦋 Changeset detected

Latest commit: d6b5bf4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@ithaka/pharos Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Nov 3, 2023

size-limit report 📦

Path Size
packages/pharos/lib/index.js 52.79 KB (+0.07% 🔺)

@brentswisher brentswisher merged commit 1875aaa into develop Nov 6, 2023
11 checks passed
@brentswisher brentswisher deleted the bugfix/external-links-open-in-new-tab branch November 6, 2023 21:11
sirrah-tam added a commit to sirrah-tam/pharos that referenced this pull request Nov 15, 2023
commit 1f29064
Merge: 5dc8c3e 1875aaa
Author: Mat Harris <mat.harris@ithaka.org>
Date:   Wed Nov 15 12:42:11 2023 -0500

    Merge branch 'develop' of github.com:ithaka/pharos into develop

commit 1875aaa
Author: Brent Swisher <brent@brentswisher.com>
Date:   Mon Nov 6 16:11:11 2023 -0500

    fix(sidenav-link): external link opens in new tab (ithaka#645)

    External links now will open in a new tab matching the documentation,
    as well as having rel="noopener" added to the link. If a target is
    manually specified it will be used instead of the "_blank" set by
    it being external.
sirrah-tam pushed a commit to sirrah-tam/pharos that referenced this pull request Dec 1, 2023
External links now will open in a new tab matching the documentation,
as well as having rel="noopener" added to the link. If a target is
manually specified it will be used instead of the "_blank" set by
it being external.
daneah added a commit that referenced this pull request Dec 19, 2023
* develop:
  A11y revamp: Pharos buttons (non-breaking change) (#628)
  Radio, Checkbox: Fix group label (#652)
  Add elevation tokens and documentation (#643)
  fix(sidenav-link): external link opens in new tab (#645)
  Upgrade to TypeScript 5 (#644)
  feat(cli): add newly created components created using pharos-cli to initComponents files (#630)
  chore: version packages (#640)
  Coach Mark: Fix react component positioning (#638)
  Coach Mark: Documentation fixes (#639)
  chore(deps): bump @babel/traverse from 7.20.0 to 7.23.2 (#637)
  chore: version packages (#636)
  Icon: Add Panorama icon (#631)
  chore: version packages (#629)
  Loading spinner: add small and on background variant (#627)
  chore: version packages (#626)
  Sheet: allow expansion with attribute (#625)
  fix(button): remove fill on subtle disabled button on background (#618)
  chore(deps-dev): bump postcss from 8.4.25 to 8.4.31 (#624)
  chore: version packages (#623)
  Sheet: Add more close options and transition timing function (#620)
@github-actions github-actions bot mentioned this pull request Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PharosSidenavLink: External links don't open in a new tab
4 participants