Fix: make smoothscroll work with markdown links & update broken links (glossary) #234
No reviewers
Labels
No labels
area: devops
area: discovery
area: docs
area: livestream
area: proposal
campaign-blocker
consider soon
Content
dependencies
Epic
good first issue
hacktoberfest
help wanted
icebox
level: 1
level: 2
level: 3
level: 4
needs: exploration
needs: grooming
needs: priority
needs: repro
needs: tech design
on hold
priority: blocker
priority: high
priority: low
priority: medium
resilience
Tom's Wishlist
type: bug
type: discussion
type: improvement
type: new feature
type: refactor
type: task
type: testing
unplanned
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: LBRYCommunity/lbry.tech#234
Loading…
Reference in a new issue
No description provided.
Delete branch "fix-glossary"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #216
Use link format
[SPV](#spv)
instead of[[SPV]]
since same page linking is case sensitive. This link format now also enables smooth scrolling with working browser history for same page links.Thanks for the PR @Wick, we'll get a review on it!! Can we send you some appreciation for your effort?
@ -43,4 +41,1 @@
event.target.parentElement.className === "api__toc__item" ||
event.target.parentElement.parentElement.className === "component--glossary-toc"
) history.replaceState({}, "", `#${element}`);
});
Does removing this block affect other pages? For example, if I click a glossary link from the Overview page, will the smooth scroll and anchoring happen?
I'm not sure how to checkout your branch to test myself.
@ -43,4 +41,1 @@
event.target.parentElement.className === "api__toc__item" ||
event.target.parentElement.parentElement.className === "component--glossary-toc"
) history.replaceState({}, "", `#${element}`);
});
@Wick ^
@ -43,4 +41,1 @@
event.target.parentElement.className === "api__toc__item" ||
event.target.parentElement.parentElement.className === "component--glossary-toc"
) history.replaceState({}, "", `#${element}`);
});
Tested on the overview page + api page and it smooth scrolls as it should and updates the URL. My reasoning behind the change was that if it manages to successfully find an element to scroll to it can safely be added to browser history.
I noticed a related issue though: that when smooth-scrolling occurs it wont get properly placed in browser history, on current site as well (navigate with the sidebar then click back in the browser).
My latest commit will fix this by changing from history.replaceState to history.pushState for updating browser history.
Let me know if you need anything more :)
@ -43,4 +41,1 @@
event.target.parentElement.className === "api__toc__item" ||
event.target.parentElement.parentElement.className === "component--glossary-toc"
) history.replaceState({}, "", `#${element}`);
});
Sweet, sounds good to me. Thanks!