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

gatsby-plugin-catch-links: do not catch anchor links (href="#foobar") #2994

Conversation

TomiTakussaari
Copy link
Contributor

I noticed that IE 11 directed to page "/#foobar" when there was with href="#foobar" in page /docs/ (generated via markdown & with gatsby-plugin-catch-links enabled), which should have taken me to /docs/#foobar.

Chrome, Firefox and Edge worked fine though, not sure how they did that.

Fix seemed to be to use anchor.hash instead of anchor.target.hash.

anchor.target.hash does not exist afaik

https://www.w3schools.com/jsref/prop_anchor_hash.asp
https://www.w3schools.com/jsref/prop_anchor_target.asp

Use anchor.hash instead of anchor.target.hash

https://www.w3schools.com/jsref/prop_anchor_hash.asp

Previously atleast IE 11 directed to page in / when there was <a> with href="#foobar" in non-root path, eg. /docs/
@TomiTakussaari TomiTakussaari force-pushed the topics/gatsby-plugin-catch-links-skip-anchors branch from 7351208 to 78eb6c7 Compare November 22, 2017 14:51
@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit 7351208041ace810aa4ccee1073cd6327daf420e

https://deploy-preview-2994--gatsbygram.netlify.com

@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit 7351208041ace810aa4ccee1073cd6327daf420e

https://deploy-preview-2994--using-drupal.netlify.com

@gatsbybot
Copy link
Collaborator

gatsbybot commented Nov 22, 2017

Deploy preview ready!

Built with commit a423969

https://deploy-preview-2994--gatsbygram.netlify.com

@gatsbybot
Copy link
Collaborator

gatsbybot commented Nov 27, 2017

Deploy preview ready!

Built with commit a423969

https://deploy-preview-2994--using-drupal.netlify.com

@KyleAMathews
Copy link
Contributor

Deploy preview failed.

Built with commit cbdf09f

https://app.netlify.com/sites/using-glamor/deploys/5a1c46c9a11477717ae5b7aa

@KyleAMathews
Copy link
Contributor

Huh, yeah. Targets don't have hashes true :-) Thanks for the fix!

@KyleAMathews KyleAMathews merged commit 1c531ae into gatsbyjs:master Nov 28, 2017
@TomiTakussaari TomiTakussaari deleted the topics/gatsby-plugin-catch-links-skip-anchors branch November 28, 2017 08:43
@jlengstorf
Copy link
Contributor

Hiya @TomiTakussaari! 👋

This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here.

Gatsby is built by awesome people like you. Let us say “thanks” in two ways:

  1. We’d like to send you some Gatsby swag. As a token of our appreciation, you can go to the Gatsby Swag Store and log in with your GitHub account to get a coupon code good for one free piece of swag. (We’ve got t-shirts and hats, plus some socks that are really razzing our berries right now.)
  2. If you’re not already part of it, we just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’.

Thanks again! 💪💜

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.

6 participants