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

<Link> component adds leading slash / to URLs only in Webkit browsers #5573

Closed
1 task done
Hansenq opened this issue Feb 26, 2023 · 3 comments
Closed
1 task done

<Link> component adds leading slash / to URLs only in Webkit browsers #5573

Hansenq opened this issue Feb 26, 2023 · 3 comments

Comments

@Hansenq
Copy link

Hansenq commented Feb 26, 2023

What version of Remix are you using?

1.13.0

I also tested with 1.12.0 and confirmed that the issue is not present in 1.12.0

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

  1. Create a new Remix project, just the basics
npx create-remix@latest
cd ./my-app
  1. Edit app/routes/index.tsx so that one of the <a> tags is changed to a <Link> tag:
import { Link } from "@remix-run/react";

export default function Index() {
  return (
    <div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
      <h1>Welcome to Remix</h1>
      <ul>
        <li>
          <Link
            target="_blank"
            to="https://remix.run/tutorials/blog"
            rel="noreferrer"
          >
            15m Quickstart Blog Tutorial
          </Link>
        </li>
        <li>
          <a
            target="_blank"
            href="https://remix.run/tutorials/jokes"
            rel="noreferrer"
          >
            Deep Dive Jokes App Tutorial
          </a>
        </li>
        <li>
          <a target="_blank" href="https://remix.run/docs" rel="noreferrer">
            Remix Docs
          </a>
        </li>
      </ul>
    </div>
  );
}

Run the server and open the page in Safari (or another Webkit browser). Note that this bug does not occur on desktop Google Chrome.

Expected Behavior

We expect the first <a> tag to have a href value of https://remix.run/tutorials/blog.

The correct behavior appears in Chrome. If you install 1.12.0 and test on Safari, the issue is not present.

Screen Shot 2023-02-25 at 11 11 34 PM

Actual Behavior

In Webkit browsers (Safari, iOS Chrome) and Android Chrome running Remix 1.13.0, the first <a> tag has a href value of /https://remix.run/tutorials/blog. This breaks the anchor tag because clicking on the link takes you to http://localhost:3001/https://remix.run/tutorials/blog, which is incorrect.

Note that only the first <a> tag has the wrong href value because it's the only anchor tag that was changed to use a <Link> tag in the code. Also note that this bug does not occur in desktop Google Chrome.

Screen Shot 2023-02-25 at 11 03 51 PM

@brophdawg11
Copy link
Contributor

I believe this is a dup of remix-run/react-router#10112 - could you test on remix@1.14.0-pre.1 and see if you still have the issue?

@Hansenq
Copy link
Author

Hansenq commented Feb 27, 2023

Thanks, looks like it's fixed on 1.14.0-pre.1!

@brophdawg11
Copy link
Contributor

Fixed in 1.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants