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

fix: LinkButton does not open in new tab #1047

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gitstart
Copy link
Contributor

@gitstart gitstart commented May 16, 2023

Fixes strapi/strapi#16378

What does it do?

  • External links do not open a new tab with isExternal set to true.

Why is it needed?

  • External links open in a new tab with isExternal set to true on LinkButton.

How to test it?

  1. Run the app yarn develop
  2. Find LinkButton in V2 and click on Default button.
  3. See that it opens a new tab.

Demo

Screen.Recording.2023-05-16.at.9.25.15.AM.mov

Co-authored-by: oxenprogrammer <7220167+oxenprogrammer@users.noreply.github.com>
Co-authored-by: raph941 <45232708+raph941@users.noreply.github.com>
@vercel
Copy link

vercel bot commented May 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
design-system ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2023 8:36am
design-system-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2023 8:36am

@@ -42,11 +42,23 @@ const LinkWrapper = styled(BaseButtonWrapper)`

export const LinkButton = React.forwardRef<HTMLAnchorElement, LinkButtonProps>(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current implementation of the Flex and Box components is currently limited due to the utilization of the shouldForwardProp function from styled-components. While it functions well for the majority of use cases, it can pose challenges when we utilize the as property to bind a different component for rendering in the DOM, as the necessary props are not forwarded to the component.

To illustrate this behavior, here's a brief demonstration.

@gitstart gitstart marked this pull request as ready for review May 16, 2023 08:55
@nathan-pichon nathan-pichon added pr: fix This PR is fixing a bug source: design-system relates to design-system package labels May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix This PR is fixing a bug source: design-system relates to design-system package
Projects
Status: To be reviewed
Development

Successfully merging this pull request may close these issues.

Marketplace links don't open in new tab
3 participants