-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Description
What is the URL of the page with the issue?
https://pkg.go.dev/os (any well documented package, but os is a good example)
What is your user agent?
Mozilla/5.0 (X11; Linux x86_64; rv:145.0) Gecko/20100101 Firefox/145.0
Screenshot
What did you do?
Go to pkg.go.dev/os and click "Types" in the navigation bar.
What did you see happen?
Types is not expanded and instead I see Examples expanded with ReadDir highlighted in the navigation bar.
What did you expect to see?
I expect the navigation bar not to jump suddenly and show something I didn't click on. In the case of the os package, I expect clicking "Types" in the navigation bar to list the types in the package and I don't expect the examples to be listed instead.
I've figured out that this bug is triggered in Commit 395738c / Issue #73951 (cc: @matttproud). Reverting it fixes the navigation bar issue. However, the template changes to make examples more prominent looks fine to me. That commit should work.
The root cause is more likely to be in static/frontend/ and its associated machinery. The navigation bar changes its focus as the documentation is scrolled through. As example HREF targets are immediately below their associated type HREFs, I suspect the navigation bar fails to correctly follow along when the type HREF is followed and instead the navbar thinks the immediately following HREF should be shown.
Frontend development isn't my regular wheelhouse, so I may be completely wrong.
As an aside, it's a little odd for the navigation bar to hop to the top and back to the bottom when scrolling the documentation. After all, each example is listed below its associated type, but the current navbar TOC breaks examples away from their types. There's flickering between Examples and Types as one scrolls through the package documentation. Maybe a workaround/better-fix is to list examples as a sub list item on each function/type?
Perhaps that's one too many cans of worms in this issue. I'd be happy browsing functions and types in the navbar even if there's some odd behavior when scrolling.