Skip to content

Commit

Permalink
Merge pull request #4895 from EnterpriseDB/bugfix/josh/squash-weird-s…
Browse files Browse the repository at this point in the history
…crolling-on-fragment-link

Move scrolling to proper callback, avoid animation
  • Loading branch information
josh-heyer authored Oct 12, 2023
2 parents 8c20c92 + f93fc46 commit 0311a9c
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 @@ -17,22 +17,5 @@ function scrollToAnchor(location, mainNavHeight = 0) {
const toc = document.querySelector(".toc-sticky .active");
if (toc) toc.scrollIntoView({ block: "nearest" });

// Check for location so build does not fail
if (location && location.hash) {
try {
const item = document.getElementById(location.hash.substring(1));

if (item) {
window.scrollTo({
top: item.offsetTop - mainNavHeight,
behavior: "smooth",
});
}
} catch (error) {
// if hash is bad exception will be raised
console.error(error);
}
}

return true;
}
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

1 comment on commit 0311a9c

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.