When an embedded app using the provided <AppProvider> component renders a Polaris <Button> component with the url and external properties set, the rendered button does not open in a new tab/window.
<AppProvider> overrides the LinkComponent, which is fine for links, but the Polaris Button component actually renders an UnstyledLink component when the url property is provided. The UnstyledLink normally sets the target on the rendered <a> when external is provided, but the intercepting RemixPolarisLink does not.
Expected behavior
For the following Polaris react component:
The rendered html should include target="_blank":
Actual behavior
For the same Polaris react component as above, the rendered html does not include target="_blank":
Steps to reproduce the problem
Create a new remix app using the shopify-app-remix-template template
Replace the <script> tag in app/routes/app.tsx with <AppProvider>, as instructed in the migration docs
Add a Polaris button component to the route, providing both the url and external properties
Hi @joseph-carino thank you for reporting this issue, we'll take a look 👍 Is using the LinkComponent a valid workaround for you or do you need to use Button?
Issue summary
Before opening this issue, I have:
@shopify/*
package and version: @shopify/shopify-app-remix 3.0.0{ logger: { level: LogSeverity.Debug } }
in my configuration, when applicableWhen an embedded app using the provided
<AppProvider>
component renders a Polaris<Button>
component with theurl
andexternal
properties set, the rendered button does not open in a new tab/window.<AppProvider>
overrides the LinkComponent, which is fine for links, but the Polaris Button component actually renders an UnstyledLink component when theurl
property is provided. The UnstyledLink normally sets thetarget
on the rendered<a>
whenexternal
is provided, but the interceptingRemixPolarisLink
does not.Expected behavior
For the following Polaris react component:
The rendered html should include
target="_blank"
:Actual behavior
For the same Polaris react component as above, the rendered html does not include
target="_blank"
:Steps to reproduce the problem
<script>
tag inapp/routes/app.tsx
with<AppProvider>
, as instructed in the migration docsurl
andexternal
properties