Skip to content

Commit

Permalink
gatsby-plugin-catch-links: do not catch anchor links (href="#foobar") (
Browse files Browse the repository at this point in the history
…#2994)

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/
  • Loading branch information
TomiTakussaari authored and KyleAMathews committed Nov 28, 2017
1 parent 998ffdc commit 1c531ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/gatsby-plugin-catch-links/src/catch-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function(root, cb) {
// Don't catch links pointed to the same page but with a hash.
if (
anchor.pathname === window.location.pathname &&
anchor.target.hash !== ``
anchor.hash !== ``
) {
return true
}
Expand Down

0 comments on commit 1c531ae

Please sign in to comment.