Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Updated gatsby and added a function in gatsby-browser.js to enable scroll to hashtag #175

Merged
merged 1 commit into from
Jun 29, 2020

Conversation

jeesunikim
Copy link
Contributor

@jeesunikim jeesunikim commented Jun 29, 2020

Problem:
hash-links-bug-480

On /docs' Run Core Node - configuring, for example, if you click links that are targeting hash links. They won't work most of the time (some of the hash links I clicked for the first time worked; I've tried multiple times on incognito, but happens randomly).

Gatsby's Recommendations for programmatic, in-app navigation recommends to use an anchor tag (which what we were already using) or reach/router's navigate.

UPDATING GATSBY AND ITS DEPENDENCIES
I thought maybe updating gatsby would fix scrolling issues but it did not! But I think it's good to keep our dependencies updated so making a PR of it anyway.

I did yarn outdated and installed to the version under Wanted - double checked locally, didn't see any issues.

yarn-outdated

Scroll to a hash tag section when anchor hash tag is clicked

  • Anchor hash tag doesn't seem to work in mdx. I played with plain <h2/> tag and it didn't work. I couldn't figure out why even by reading MDX documentation. I decided to use gatsby-browser.js's shouldUpdateScroll function to target the section
  • I thought of using a library such as “gatsby-remark-autolink-headers”, but this one is using for older version - it's using react router not reach router

@stellar-jenkins
Copy link

@vcarl
Copy link
Contributor

vcarl commented Jun 29, 2020

I wonder if this is the same root issue as #170 , I notice that on a totally fresh tab, opening e.g. https://developers.stellar.org/docs/run-core-node/configuring/#example-configurations works correctly, and I'm able to click a heading and have it work correctly once. The right side nav + header links stop working at the same time.

This is a solid immediate fix for the behavior, but we might be able to remove this logic upon fixing #170.

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

Successfully merging this pull request may close these issues.

3 participants