Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/cmd/godoc: results page jumps during rendering #21685

Closed
bcmills opened this issue Aug 29, 2017 · 8 comments
Closed

x/tools/cmd/godoc: results page jumps during rendering #21685

bcmills opened this issue Aug 29, 2017 · 8 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Aug 29, 2017

Example page: https://tip.golang.org/search?q=testing

The results initially render with the (IMO) most useful package links,¹ then replace them a short time later with a long list of cross-references.² If you try to click on one of the package links, you're fairly likely to end up on an arbitrarily different page than you intended.

Ideally, the whole page should load instantly. However, if that is not possible, we should structure the page so that it does not jump around as it loads.

(CC: @alandonovan @stamblerre)

¹rsec5dcglnt

²01paakzo3ju

@agnivade
Copy link
Contributor

agnivade commented Aug 7, 2018

The cross-references are generated post document load event, through some javascript. Currently, it has a very rudimentary heuristic which just splits the elements into 2 columns if it exceeds a threshold. Also, it uses <table> tags to display the code which is not very elegant.

Ideally, we should make all these decisions server side and send a properly structured data to the client.

So then,

I will take a look at it for 1.12.

@agnivade agnivade self-assigned this Aug 7, 2018
@jimmyfrasche
Copy link
Member

For the layout itself, there's https://caniuse.com/#feat=multicolumn Despite having good support on paper, it's still kinda buggy. Even when everything's working right it never quite seems to work as well as advertised. It's always hard to say if it will work in a given situation, but, when it does, it works well and is simpler than the alternatives. So, even if it ultimately doesn't work, it's usually worth trying it first.

@agnivade
Copy link
Contributor

agnivade commented Aug 7, 2018

Thanks. I have used it before. Will give it a shot.

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 7, 2018
@agnivade
Copy link
Contributor

agnivade commented Aug 8, 2018

Nearly got it working. Only slight issue is that there is no notion of minimum column-height. So all elements will fill to all the columns. Therefore, it looks odd if the no. of elements is low.

cc

In this case, it looks good if they are split into 2 columns. To fix this, I can add some heuristics and send an appropriate css class attached to the div from server side. But then, it would require 4 classes in the css file, each for a separate column-count value. I would really like a native css solution to this.

@jimmyfrasche - Any way to tackle this ?

paging other css wizards too @andybons

@jimmyfrasche
Copy link
Member

You could inject custom properties into the dom with an appropriately placed style="--max-cols: 2;" based on the server-side heuristics

@agnivade
Copy link
Contributor

agnivade commented Aug 8, 2018

Hmm .. not the most elegant solution. But works. No way to make minimum column height I guess ?

@jimmyfrasche
Copy link
Member

Not that I am aware of.

@gopherbot
Copy link

Change https://golang.org/cl/129135 mentions this issue: godoc: generate TOC from server-side for search page

@golang golang locked and limited conversation to collaborators Oct 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants