Don't show search bar when clicking on an anchor link#353
Merged
davepagurek merged 1 commit intomainfrom May 16, 2024
Merged
Conversation
outofambit
approved these changes
May 16, 2024
Collaborator
outofambit
left a comment
There was a problem hiding this comment.
hey @davepagurek! this looks like a reasonable implementation and works great for me locally. the reason I hadn't gone further down this route is I was trying to avoid adding more running javascript to the site unless we really needed to, but I have had to do that in a few places with the navigation menu. This seems like it would be okay since its running once on page load and then only when an anchor link is clicked.
Collaborator
Author
|
Thanks for testing it out! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wanted to take a crack at this to see if I could get it working to make the mobile experience a bit better (where just hovering at the top of the page isn't feasible.) My approach was to record when an anchor link is clicked, and detect when auto scrolling stops as a result of that, and prevent opening the settings bar in that in between phase. I tried to make it robust to any dynamically added anchors with a mutation observer, not sure if that's overkill or not.