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

Bad page rendering with js disabled #64988

Closed
GuillaumeGomez opened this issue Oct 2, 2019 · 8 comments · Fixed by #64994
Closed

Bad page rendering with js disabled #64988

GuillaumeGomez opened this issue Oct 2, 2019 · 8 comments · Fixed by #64994
Assignees
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Oct 2, 2019

For example in here: https://docs.rs/slab/0.4.2/slab/struct.Slab.html

No sections is shown because they're hidden by default. It should be overloaded with noscript so that they show by default in such case.

@GuillaumeGomez GuillaumeGomez self-assigned this Oct 2, 2019
@GuillaumeGomez GuillaumeGomez added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Oct 2, 2019
@GuillaumeGomez
Copy link
Member Author

cc rust-lang/docs.rs#419

@the8472
Copy link
Member

the8472 commented Oct 2, 2019

Using <details>/<summary> for all sections that can be toggled would be a noscript-compatible, interactive solution. It can still be enhanced by javascript to respect global toggles.

Edge doesn't support it but that just means edge users will have to rely on javascript as they already do today.

@GuillaumeGomez
Copy link
Member Author

GuillaumeGomez commented Oct 3, 2019

I'm not sure it'd fix the initial issue which made us add this auto-parts hiding. We're doing a lot of changes into the DOM so the goal is to not render it in order to make the rendering way faster.

Also, we're currently supporting down to IE9. So if a recent browser like Edge doesn't support it, I'm not too much into using such a feature...

@the8472
Copy link
Member

the8472 commented Oct 3, 2019

We're doing a lot of changes into the DOM so the goal is to not render it in order to make the rendering way faster.

The content of details is hidden by default, only the summary is shown until you open it. So it would keep that property

Also, we're currently supporting down to IE9. So if a recent browser like Edge doesn't support it, I'm not too much into using such a feature...

I don't see any problems though

IE Edge Browsers with <details> support
javascript CSS, JS solution
as good as current
CSS, JS solution
as good as current
<details> + JS solution, better accessibility than current
noscript N/A
no noscript extensions in IE
currently broken. could add noscript CSS (as PR does) but leaving it broken would be no worse than current. will move to chromium soon anyway interactive by default browser behavior, improvement over current

@GuillaumeGomez
Copy link
Member Author

The advantage of the current situation is that it works on all supported browsers whereas details would just show everything and slow down the page rendering on old web browsers which are already the slowest. Once we drop old browsers support, I'm all for it but for now, not too much like I said...

@the8472
Copy link
Member

the8472 commented Oct 3, 2019

The advantage of the current situation is that it works on all supported browsers whereas details would just show everything

Details does not show things by default unless you add the open attribute.

The same behavior can be implemented in old browsers with CSS rules. Javascript would only have to toggle the attribute.

Lorem ipsum Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent et sem et lacus tincidunt posuere id sed orci. Orci varius natoque penatibus et magnis dis parturient montes

@GuillaumeGomez
Copy link
Member Author

That doesn't answer my concerns at all:

The advantage of the current situation is that it works on all supported browsers whereas details would just show everything and slow down the page rendering on old web browsers which are already the slowest. Once we drop old browsers support, I'm all for it but for now, not too much like I said...

@the8472
Copy link
Member

the8472 commented Oct 3, 2019

simplified compatibility shim for IE, omitting the caret styling:

// default.css
details > * {display: none;}
details > summary {display: block;}
details[open] > * {display: block;}

// noscript.css
details > * {display: block;}

This way it would not show everything by default and still would have to be unfolded via JS, exactly the same as today. No negative impact on rendering performance.

@bors bors closed this as completed in 2e72448 Oct 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants