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

Fix source sidebar bugs #98671

Merged
merged 7 commits into from
Jul 1, 2022
Merged

Conversation

GuillaumeGomez
Copy link
Member

@GuillaumeGomez GuillaumeGomez commented Jun 29, 2022

This PR fixes the following two bugs:

Screenshot from 2022-06-29 14-39-58
Screenshot from 2022-06-29 15-05-09

I added regression tests to prevent them to happen again.

I think we should backport it to beta as well.

You can test it here.

cc @jsha
r? @notriddle

@GuillaumeGomez GuillaumeGomez added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: rustdoc UI (generated HTML) labels Jun 29, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 29, 2022
@notriddle
Copy link
Contributor

Can you put together a sample with enough source files to make it scroll?

@GuillaumeGomez
Copy link
Member Author

I pushed my local std docs. I updated the link as well.

@notriddle
Copy link
Contributor

It works, and it’s definitely an improvement, but it still inherits a long-standing bug where the sidebar doesn’t prevent the main content view from scrolling. Think you can address this one at the same time, or should that be a separate pull request?

@GuillaumeGomez
Copy link
Member Author

I intended it to be this way (to be able to scroll while having the sidebar open on mobile). So not a bug (at least for me ^^').

@notriddle
Copy link
Contributor

@GuillaumeGomez On mobile?

Sorry that I forgot to mention that I was testing this on a smartphone. Your screenshots looked like mobile screenshots, since there was no content view visible, but I guess you just cropped them.

The desktop behavior is fine, but if the viewport is small enough that the sidebar fills the entire screen, scrolling on the main content view should probably be prevented, since it isn't visible.

@GuillaumeGomez
Copy link
Member Author

Oh I see! I never realized it was possible. I can simply make the other content disappear to prevent it.

@notriddle
Copy link
Contributor

notriddle commented Jun 29, 2022

@GuillaumeGomez

I recommend reading this CSS-Tricks post, because if someone scrolls down partway, then opens the full-screen "sidebar", then closes it again without clicking over to a different file, you're going to want to preserve their scroll position. And Mobile Safari does not behave identically to Chrome for Android here.

@GuillaumeGomez
Copy link
Member Author

Writing the GUI test will be a nightmare. 😿

@GuillaumeGomez
Copy link
Member Author

Oh actually not so much, body.scrollTop gives that information. Should be quite easy then.

@GuillaumeGomez
Copy link
Member Author

So long story short, body.scrollTop always returns 0 so I had to add new commands to browser-ui-test to be able to use window.pageYOffset to get a good value (hence the commit which updates the browser-ui-test version).

I also updated the demo. Thanks a lot for all the suggestions @notriddle !

@notriddle
Copy link
Contributor

It doesn’t work in Mobile Safari. Your demo site still allows me to scroll the main page while the full-screen “sidebar” is open.

@GuillaumeGomez
Copy link
Member Author

Sorry, I forgot to upload the docs... Please retry. (I was wondering why the css rule I added wasn't there when testing)

@notriddle
Copy link
Contributor

I’ve retried, and it still hasn’t fixed it. Sorry.

@GuillaumeGomez
Copy link
Member Author

So visibility doesn't do the trick... Well, let's try something else then...

@GuillaumeGomez
Copy link
Member Author

I updated the fix. I had to include JS (following the tutorial you provided) and it's now working as expected on Android Firefox/Chrome/Opera. I updated the online demo too.

@notriddle
Copy link
Contributor

Yes, that works. Thank you.

r=me once CI passes

@GuillaumeGomez
Copy link
Member Author

@bors r=notriddle

@bors
Copy link
Contributor

bors commented Jun 30, 2022

📌 Commit 9a1f52d has been approved by notriddle

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 30, 2022
@GuillaumeGomez
Copy link
Member Author

@bors rollup

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 30, 2022
…, r=notriddle

Fix source sidebar bugs

This PR fixes the following two bugs:

![Screenshot from 2022-06-29 14-39-58](https://user-images.githubusercontent.com/3050060/176449070-3e3762da-2bfe-4acf-8eb0-34f6eb4c94ed.png)
![Screenshot from 2022-06-29 15-05-09](https://user-images.githubusercontent.com/3050060/176449073-b164820b-bd71-4b1a-990c-bba4e5fce196.png)

I added regression tests to prevent them to happen again.

I think we should backport it to beta as well.

You can test it [here](https://rustdoc.crud.net/imperio/source-sidebar-fixes/src/std/lib.rs.html).

cc `@jsha`
r? `@notriddle`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 30, 2022
…, r=notriddle

Fix source sidebar bugs

This PR fixes the following two bugs:

![Screenshot from 2022-06-29 14-39-58](https://user-images.githubusercontent.com/3050060/176449070-3e3762da-2bfe-4acf-8eb0-34f6eb4c94ed.png)
![Screenshot from 2022-06-29 15-05-09](https://user-images.githubusercontent.com/3050060/176449073-b164820b-bd71-4b1a-990c-bba4e5fce196.png)

I added regression tests to prevent them to happen again.

I think we should backport it to beta as well.

You can test it [here](https://rustdoc.crud.net/imperio/source-sidebar-fixes/src/std/lib.rs.html).

cc ``@jsha``
r? ``@notriddle``
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 1, 2022
…askrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#97629 ([core] add `Exclusive` to sync)
 - rust-lang#98503 (fix data race in thread::scope)
 - rust-lang#98670 (llvm-wrapper: adapt for LLVMConstExtractValue removal)
 - rust-lang#98671 (Fix source sidebar bugs)
 - rust-lang#98677 (For diagnostic information of Boolean, remind it as use the type: 'bool')
 - rust-lang#98684 (add test for 72793)
 - rust-lang#98688 (interpret: add From<&MplaceTy> for PlaceTy)
 - rust-lang#98695 (use "or pattern")
 - rust-lang#98709 (Remove unneeded methods declaration for old web browsers)
 - rust-lang#98717 (get rid of tidy 'unnecessarily ignored' warnings)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b1403d6 into rust-lang:master Jul 1, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 1, 2022
@GuillaumeGomez GuillaumeGomez deleted the source-sidebar-fixes branch July 1, 2022 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: rustdoc UI (generated HTML) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants