Skip to content

Commit

Permalink
Just disable smooth scrolling across the board
Browse files Browse the repository at this point in the history
Then rely on default behavior.
  • Loading branch information
josh-heyer committed Oct 11, 2023
1 parent 5dc76a6 commit f5e0f27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
17 changes: 0 additions & 17 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@ require("prismjs/plugins/command-line/prism-command-line.css");

exports.onRouteUpdate = ({ location }) => scrollToAnchor(location);

exports.shouldUpdateScroll = ({
prevRouterProps,
routerProps,
pathname,
getSavedScrollPosition,
}) => {
let hashElem =
routerProps.location.hash &&
document.getElementById(routerProps.location.hash.substring(1));
// avoid obscure issue where scrolling to hash in gatsby-react-router-scroll slams to end of page if animated
if (hashElem) {
hashElem.scrollIntoView({ behavior: "instant" });
return false;
}
return true; // default
};

/**
*
* @desc - a function to jump to the correct scroll position
Expand Down
8 changes: 6 additions & 2 deletions src/styles/_helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ svg {
.arrow-list {
list-style-type: "";
}
html {
scroll-behavior: smooth;


// force-disable this - it causes annoying jumps when navigating, and a bug w/ anchor links in Firefox
$enable-smooth-scroll: false;
:root {
scroll-behavior: auto !important;
}

/* fill colors */
Expand Down

0 comments on commit f5e0f27

Please sign in to comment.