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

Optimize documentation layout on mobile #20850

Closed
3 tasks done
iKevinY opened this issue Jan 10, 2015 · 9 comments
Closed
3 tasks done

Optimize documentation layout on mobile #20850

iKevinY opened this issue Jan 10, 2015 · 9 comments

Comments

@iKevinY
Copy link
Contributor

iKevinY commented Jan 10, 2015

Considering the fact that Rust has moved into alpha and The Rust Programming Language has replaced the Guide, I think it would be useful to work towards creating a mobile-friendly layout for Rust's documentation. #17926 discusses the Guide, but now that the Book has replaced the Guide and brought a whole new layout that includes a sidebar, more than just a viewport fix will be needed to make it mobile-friendly. From what I can tell, there are a few "page families" that would need some tweaking (complete with fancy GitHub-powered checklist):

For the Rust Reference and Rust Documentation, a viewport meta tag might be all we need to make it mobile-friendly. The API Docs actually look pretty good on mobile already (the sidebar is pushed to the bottom of the page), but the page appears to load slightly zoomed-in (another viewport fix, likely).

The Book is rendered on mobile pretty much equivalently to the way it is displayed on larger displays, but it would be ideal for the content take up the full width of the screen. This leaves the sidebar to either be placed at the bottom of the page or converted into a dropdown menu of some sort. Thoughts?

@huonw huonw added the A-docs label Jan 10, 2015
@telotortium
Copy link
Contributor

Even on desktop, the content is rendered at a size slightly larger than the viewport (I hope this is the correct term, I'm not a web developer). Therefore, on all platforms, you have to scroll horizontally just a bit in order to see the right margin of the content. Is this related?

@iKevinY
Copy link
Contributor Author

iKevinY commented Jan 10, 2015

@telotortium Are there any specific pages that this occurs on? Also, what browser are you using?

@telotortium
Copy link
Contributor

Any page in the Rust book, in both Chrome and Firefox mobile. It's still a problem on desktop unless the window's at least 1000px wide, which is wider than almost all phones.

It seems like neither the table of contents nor the body reflows if the window is narrowed, but the viewport of the table of contents remains a fixed width, so less space is allotted for the body.

@iKevinY
Copy link
Contributor Author

iKevinY commented Jan 11, 2015

Ah, I see what you're talking about now. The CSS for the book looks pretty minimalistic at the moment, so it's not too surprising that it's not particularly responsive. I think it will be significantly easier to fix the layout of the latter 2 items in the checklist, as the Book will be a pretty large undertaking.

@steveklabnik
Copy link
Member

Yes, it's very much just the basics. I'd love a patch.

@kmcallister
Copy link
Contributor

alexcrichton added a commit to alexcrichton/rust that referenced this issue Jan 15, 2015
Helps with mobile friendliness of The Rust Book rust-lang#20850
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jan 15, 2015
Just a couple of tweaks to improve the appearance of pages like [The Rust Reference](http://doc.rust-lang.org/reference.html) on mobile to advance the progress of rust-lang#20850. Changing the viewport wasn't quite good enough to make it mobile-friendly, as large tables forced the page to become wider than the screen width. Using `overflow-x`, tables that are too large become horizontally scrollable instead of forcing the *entire page* to become horizontally scrollable.

Also, there was at least one case where an extremely long piece of inline code was wider than the actual width of the screen (`std::ptr::copy_nonoverlapping_memory`), so I changed `word-wrap` to allow inline code to break in the middle of words instead of only text within `pre` tags.

This isn't a change included in this PR, but rather something up for discussion. Currently, code blocks that contain long lines simply wrap onto the next line. What if rather than wrapping, they were horizontally scrollable instead? I'm not sure what the general preference is regarding this.

r? @steveklabnik
@frewsxcv
Copy link
Member

Related issue: #16174

@iKevinY
Copy link
Contributor Author

iKevinY commented Jan 29, 2015

Google's Mobile-Friendly Test now rates all pages as mobile-friendly, so it looks like issue can be closed.

@iKevinY iKevinY closed this as completed Jan 29, 2015
@kmcallister
Copy link
Contributor

\o/ Thanks everyone who helped make this happen!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants