Skip to content

Don't show search bar when clicking on an anchor link#353

Merged
davepagurek merged 1 commit intomainfrom
feat/search-bar-anchor-click
May 16, 2024
Merged

Don't show search bar when clicking on an anchor link#353
davepagurek merged 1 commit intomainfrom
feat/search-bar-anchor-click

Conversation

@davepagurek
Copy link
Copy Markdown
Collaborator

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.

anchor-scroll

@davepagurek davepagurek requested a review from outofambit May 15, 2024 13:22
Copy link
Copy Markdown
Collaborator

@outofambit outofambit left a comment

Choose a reason for hiding this comment

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

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.

@davepagurek
Copy link
Copy Markdown
Collaborator Author

Thanks for testing it out!

@davepagurek davepagurek merged commit 9cfd4f0 into main May 16, 2024
@davepagurek davepagurek deleted the feat/search-bar-anchor-click branch May 16, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants