Uh oh!
There was an error while loading. Please reload this page.
rustdoc: improve click behavior of the source code mobile full-screen "sidebar" - #98776
Conversation
rustbot
commented
Jul 1, 2022
Some changes occurred in HTML/CSS/JS. cc @GuillaumeGomez, @Folyd, @jsha |
rust-highfive
commented
Jul 1, 2022
r? @CraftSpider (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
9ae57a4 to
d7141daCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Instead of doing this, wouldn't it be simpler to not open the sidebar by default when we arrive on a new page with a "mobile width"?
There was a problem hiding this comment.
That would be possible, but it would open up the following, very weird timeline:
- A user with a 7-inch Android tablet in portrait mode clicks open the sidebar. The sidebar is now open, and
rustdoc-source-sidebar-show == "true". - The user clicks a link. The sidebar is now closed, but
rustdoc-source-sidebar-show == "true". - The user rotates their tablet into landscape mode. The sidebar is still closed, but
rustdoc-source-sidebar-show == "true". - The user clicks an inline jump to definition link.
- The sidebar pops open, seemingly out of nowhere. This is bad.
There was a problem hiding this comment.
That makes sense indeed. Can you add a test where we check that a "resize" in-between won't re-open the sidebar as you mentioned?
There was a problem hiding this comment.
Okay, I've pushed commit 6e2c49f adding a test case for this.
GuillaumeGomez
commented
Jul 1, 2022
This is a very good point! I think we can simplify it a bit by just not opening the sidebar when we arrive on a new page and we have a "mobile width". |
On desktop, if you open the source code sidebar, it stays open even when you move from page to page. It used to do the same thing on mobile, but I think that's stupid. Since the file list fills the entire screen on mobile, and you can't really do anything with the currently selected file other than dismiss the "sidebar" to look at it, it's safe to assume that anybody who clicks a file in that list probably wants the list to go away so they can see it.
d7141da to
83f2288CompareGuillaumeGomez
commented
Jul 5, 2022
Thanks! @bors r+ rollup |
bors
commented
Jul 5, 2022
📌 Commit 6e2c49f has been approved by |
Rollup of 5 pull requests Successful merges: - rust-lang#97712 (ptr::copy and ptr::swap are doing untyped copies) - rust-lang#98624 (lints: mostly translatable diagnostics) - rust-lang#98776 (rustdoc: improve click behavior of the source code mobile full-screen "sidebar") - rust-lang#98856 (Remove FIXME from rustdoc intra-doc test) - rust-lang#98913 (:arrow_up: rust-analyzer) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
On desktop, if you open the source code sidebar, it stays open even when you move from page to page. It used to do the same thing on mobile, but I think that's stupid. Since the file list fills the entire screen on mobile, and you can't really do anything with the currently selected file other than dismiss the "sidebar" to look at it, it's safe to assume that anybody who clicks a file in that list probably wants the list to go away so they can see it.
Split out separately from #98772