Skip to content

Use more horizontal space on smaller screens #1643

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

Merged
merged 8 commits into from
Jan 11, 2023

Conversation

zachallaun
Copy link
Contributor

Hi there! I tend to spend a lot of time browsing HexDocs on my phone and have been wanting to do a quick pass to improve the use of horizontal space on smaller screens. This PR is the result of that.

  • Decrease size of left gutter, allowing hamburger to overlap content.
  • Full-bleed code blocks.
  • Full-bleed admonition blocks.
  • Tweak various mobile styles.
  • Improve transition effect when opening/closing sidebar.

I don't love how the hamburger overlaps headers, especially when navigating to an anchor link, but I think the trade-off is worth it here. (Before/After screenshots to follow.)

@zachallaun
Copy link
Contributor Author

Before After
before-1 after-1
before-2 after-2
before-3 after-3
before-4 after-4
before-5 after-5
before-6 after-6

@josevalim
Copy link
Member

Yeah, unfortunately I am a 👎 on the gutter changes. Which other changes make sense without the gutter change?

@zachallaun
Copy link
Contributor Author

No worries! I'm not sure any of the other changes are much of a win without the gutter changes, so probably best to close this if that won't move forward.

For my own understanding, could you share what you specifically don't like about these changes? I think the sidebar icon overlapping is definitely not optimal, but that may be a problem with a solution if it's the primary point of contention. If you are against more full-bleed blocks/etc however, then I think it's definitely safe to close this.

@josevalim
Copy link
Member

Sorry for not being clear. I was mostly agreeing with you on the overlap. :) The other ones I don't have an opinion (so I would be glad to hear from the community).

@DavidOliver
Copy link
Contributor

DavidOliver commented Jan 10, 2023

These changes make sense to me (at small viewport widths when in portrait orientation). An extra word or two on each line makes a significant difference to the reading experience, eh?

Edit: I also like the full-bleed blocks at this width for the same reason.

As width is more limited and probably more valuable than height at this viewport size and orientation, to avoid the overlap of the hamburger menu perhaps a solid background could be added, either to just the menu icon as a square (which might be weird/annoying?) or as full-width?

By the way, nice keyboards!

@cw789
Copy link
Contributor

cw789 commented Jan 10, 2023

I also find the gutter on small screens just for the menu icon wast of space. But still think the overlay of the icon (also with solid background) problematic.
I personally would prefer a header bar taking the space containing the menu icon and probably the search bar or icon and additionally the settings icon. Perhaps a bit inspired how mdBook is doing it.
In my opinion taking horizontal space is much less problematic in the contrast to have the benefit having the headline as very first element on the pages.

@josevalim
Copy link
Member

@DavidOliver a full-width background around the hamburger sounds like a good idea to me. Perhaps as a gradient so it feels more like a blend-in? I also like the full-bleed but I would only for it for code blocks for now (and the copy button should still be aligned to whatever is left of the gutter).

@zachallaun what do you think about these changes? :)

@zachallaun zachallaun force-pushed the small-screens branch 2 times, most recently from 221d959 to b4be46c Compare January 10, 2023 15:28
* Decrease size of left gutter, allowing hamburger to overlap content.
* Full-bleed code blocks.
* Full-bleed admonition blocks.
* Tweak various mobile styles.
* Improve transition effect when opening/closing sidebar.
@zachallaun
Copy link
Contributor Author

zachallaun commented Jan 10, 2023

I think a full-width background around the hamburger would be fine, especially since there's already room for it at the top of the page. We'll have to pull some margin tricks to make sure that it doesn't appear on top of headers when you visit an anchor link, but should be very doable.

@josevalim To make sure I understand, requested changes are:

  • Full-width background for hamburger icon
  • Align code block copy button and anchor link icons

Could you expand on the last one? Do you mean the copy code button for code blocks? That is currently still in the top right of the code block, same as previous. The copy-anchor button for headers, however, has moved to the right because the gutter is pretty narrow for it now. I'll get a screenshot in a moment, currently figuring out a style bug I introduced when rebasing main into this branch 😅

@zachallaun
Copy link
Contributor Author

Copy code Anchor link
image image

@zachallaun
Copy link
Contributor Author

Have a gradient background set up and adjusted anchor link positioning. Here's a sampling of screenshots:

wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ex_doc_doc_readme html(iPhone 12 Pro) (4) wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ex_doc_doc_readme html(iPhone 12 Pro) (5)
wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ex_doc_doc_readme html(iPhone 12 Pro) (6) wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ex_doc_doc_readme html(iPhone 12 Pro) (7)

@josevalim
Copy link
Member

Please keep the gutter for admonition and code. :) I will write more soon!

@josevalim
Copy link
Member

Could you expand on the last one? Do you mean the copy code button for code blocks? That is currently still in the top right of the code block, same as previous.

I mean to say that the copy button for anchors and for code should have the same alignment from the right, that's all. :)

@josevalim
Copy link
Member

The gradient looks great. I think we can move the hamburger a bit more to the left. It should not be aligned to the text because it is not part of the text... unless you believe it looks weird?

@zachallaun
Copy link
Contributor Author

Please keep the gutter for admonition and code. :) I will write more soon!

Sorry, did you mean keep it for admonition and the function headers, and let code blocks be full-width? I believe this is what you said earlier, "I also like the full-bleed but I would only for it for code blocks for now..."

I mean to say that the copy button for anchors and for code should have the same alignment from the right, that's all. :)

Got it! Right now the anchor link is a bit further to the left than the copy buttons; I'll try to align them.

I think we can move the hamburger a bit more to the left. It should not be aligned to the text because it is not part of the text... unless you believe it looks weird?

I don't feel strongly. Here's what it looks like if we don't align it to the text:

wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ex_doc_doc_readme html(iPhone 12 Pro) (8) wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ex_doc_doc_readme html(iPhone 12 Pro) (9)

@josevalim
Copy link
Member

Sorry, did you mean keep it for admonition and the function headers, and let code blocks be full-width?

Sorry :( My communication is not the best today. I meant to keep full-width as both look great.

Here's what it looks like if we don't align it to the text:

I like it. Thank you ❤️

@zachallaun
Copy link
Contributor Author

Okay, got it! I'm going to clean a few more things up and then will post an updated set of before/after screenshots to evaluate.

@zachallaun
Copy link
Contributor Author

Updated screenshots:

Before After
hexdocs pm_ecto_Ecto Query html(iPhone 12 Pro) (3) wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ecto_doc_Ecto Query html(iPhone 12 Pro) (4)
hexdocs pm_ecto_Ecto Query html(iPhone 12 Pro) (5) wsl%24_Ubuntu-2004_home_zacha_dev_forks_ecto_doc_Ecto Query html(iPhone 12 Pro) (5)
hexdocs pm_ecto_Ecto Query html(iPhone 12 Pro) (6) wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ecto_doc_Ecto Query html(iPhone 12 Pro) (7)
hexdocs pm_ecto_Ecto Query API html(iPhone 12 Pro) wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ecto_doc_Ecto Query API html(iPhone 12 Pro)
hexdocs pm_ecto_associations html(iPhone 12 Pro) wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ecto_doc_associations html(iPhone 12 Pro)
hexdocs pm_ecto_getting-started html(iPhone 12 Pro) wsl%24_Ubuntu-20 04_home_zacha_dev_forks_ecto_doc_getting-started html(iPhone 12 Pro)

@josevalim
Copy link
Member

Hi @zachallaun, everything looks great! I would only remove the full-width for the function/type signatures (the purple boxes). That's what I meant to say in the past but I failed in portraying this information correctly 3 different times (apologies).

Also, just to double check, does it also work on day mode? :)

Thank you very much! ❤️ Once the full width is removed, I will merge and ship a new beautiful version!

@zachallaun
Copy link
Contributor Author

Hi @zachallaun, everything looks great! I would only remove the full-width for the function/type signatures (the purple boxes). That's what I meant to say in the past but I failed in portraying this information correctly 3 different times (apologies).

Hah, understood now. =) Not just your fault -- My comprehension definitely could have been better.

Also, just to double check, does it also work on day mode? :)

Yep, it does! If you (or anyone else reading) wouldn't mind building the docs and poking around a bit before merging, I'd appreciate it. Want to make sure that there isn't something obvious that I've missed.

I'll remove the function signature changes now.

@josevalim josevalim merged commit e73eff7 into elixir-lang:main Jan 11, 2023
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@josevalim
Copy link
Member

Yep, it does! If you (or anyone else reading) wouldn't mind building the docs and poking around a bit before merging, I'd appreciate it. Want to make sure that there isn't something obvious that I've missed.

I will just merge for now then and hexdocs.pm/elixir/master should use ExDoc master once the next commit lands. Then we can all take it for a spin. :)

@zachallaun zachallaun deleted the small-screens branch January 11, 2023 19:36
@josevalim
Copy link
Member

The preview is live: https://hexdocs.pm/elixir/master/Kernel.html

feel free to share it online and collect feedback!

@zachallaun
Copy link
Contributor Author

@josevalim awesome! Already found one tiny bug: there’s like a 1-2px horizontal scroll due to the code blocks extending slightly past the edge of the screen. I’ll try to get a fix in tonight for it.

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

Successfully merging this pull request may close these issues.

4 participants