Skip to content

behavior of anchored/hash links in Framework #1478

Answered by shadoof
shadoof asked this question in Q&A
Discussion options

You must be logged in to vote

@mbostock and anyone interested. I solved this problem (definitely happens in Chrome but not in Firefox) with this little workaround hack:

let hashLinkChecks = 0;
const hashLinkLoader = setInterval((checksLimit = 2) => {
  let div = document.getElementById(window.location.hash.substring(1));
  if (div) {
    div.scrollIntoView();
    clearInterval(hashLinkLoader);
  }
  if (++hashLinkChecks >= checksLimit && !div) clearInterval(hashLinkLoader);
}, 100);

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@shadoof
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Fil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants