-
Notifications
You must be signed in to change notification settings - Fork 484
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
responsive side navigation #449
Conversation
Thanks for tackling this. Mobile UX is certainly somethings that's on the todolist. A couple of things that I noticed:
|
it's not perfect, added the topbar. see the Julia Documentation example.
then we need more javascript framework like bootstrap. mkdocs looks really good. |
It looks very good. Is there any reason of not merging this (besides the merge conflict)? |
Sorry, I just haven't gotten around to reviewing this. I'll try to go through this in the next few days, hopefully to get this released as part of 0.10. Together with #409 this will be a nice set of updates to the frontend bit. |
Playing around with it now I quite like the top bar and the ~80% width of the menu. But I do have a couple of items of feedback, so I hope you would be up for iterating on this PR a bit.
|
src/Writers/HTMLWriter.jl
Outdated
navmenu = render_navmenu(ctx, navnode) | ||
article = render_article(ctx, navnode) | ||
|
||
htmldoc = DOM.HTMLDocument( | ||
html[:lang=>"en"]( | ||
head, | ||
body(navmenu, article) | ||
body(topbar, div[".main"](div[".container"](navmenu, article))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer avoiding unnecessary div
s. They're not used in the style, so as far as I can tell they could be dropped. A body(topbar, navmenu, article)
ought to do.
assets/html/documenter.css
Outdated
position: fixed; | ||
top: 0px; | ||
left: 0px; | ||
right: 0px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should drop the units from the zeroes here.
src/Writers/HTMLWriter.jl
Outdated
page_title = string(mdflatten(pagetitle(ctx, navnode))) | ||
topbarleft = ul[".float-left"](li(span(page_title))) | ||
topbarright = ul[".float-right"](li(a[".btn", :href => "#"](i[".fa .fa-bars", Symbol("aria-hidden") => "true"]))) | ||
div[".topbar"](div[".container"](topbarleft, topbarright)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above -- any reason we couldn't just drop the .container
<div>
?
src/Writers/HTMLWriter.jl
Outdated
|
||
page_title = string(mdflatten(pagetitle(ctx, navnode))) | ||
topbarleft = ul[".float-left"](li(span(page_title))) | ||
topbarright = ul[".float-right"](li(a[".btn", :href => "#"](i[".fa .fa-bars", Symbol("aria-hidden") => "true"]))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the aria-hidden
here? Based on this article it seems that aria-hidden
is not very useful and, if anything, we should use HTML5's hidden
attribute.
Also, why use ul
s here, this does not feel like a list to me? A simple <div id="topbar">{PAGE_TITLE}<a class="btn fa fa-bars"></a></div>
ought to do the trick here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just updated, used span
tag to align the PAGE_TITLE in the css.
thanks for your reviews! I would investigate it at tomorrow. |
Fixed almost stuff, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! It's a really nice UX improvement on mobiles. I think headroom is worth the additional dependency.
Just a few last things:
-
I still feel that the
article > header
and#topbar
duplicate each other. Maybe we should just have aposition: fixed
onarticle > header
, hide the edit link<span>
and show the button when in mobile mode? -
I am also wondering whether it would make sense to keep the subsection titles even on mobile (i.e. like in
article > header
).
src/Writers/HTMLWriter.jl
Outdated
@tags div span a | ||
|
||
page_title = string(mdflatten(pagetitle(ctx, navnode))) | ||
div["#topbar"](span(page_title), a[".btn .fa .fa-bars", :href => "#"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have a .btn
class, so no need to apply it here I'd say.
assets/html/documenter.css
Outdated
position: fixed; | ||
width: 100%; | ||
height: 2.7em; | ||
background-color: white; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also give the #topbar
a slight background color as well, probably the same as the menu #fcfcfc
.
assets/html/documenter.css
Outdated
display: block; /* is mobile */ | ||
position: fixed; | ||
width: 100%; | ||
height: 2.7em; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make the #topbar
a bit wider in the vertical direction.
If I may I would propose a way to set the vertical heights in the following way, which I think would be a bit more clear:
- Have
padding-top: 1em
andpadding-bottom: 1em
on the#topbar
. - Drop
margin-top
fromdiv#topbar span
and only keeppadding-right: 1em
fordiv#topbar a.fa-bars
- Have an explicit
font-size: 1.5em
on thediv#topbar a.fa-bars
(as opposedx-large
) -- no other reason than to have an explicit number here. - The navlink text will be smaller, so for the
#topbar
it should also beheight: 1.5em
. - The total height of the
#topbar
will then be 3.5em, so we should also have apadding-top: 3em
on thearticle
, since the default 2em will not be enough. - The headroom should also then probably be something like
top: -4em
.
assets/html/documenter.css
Outdated
display: none; | ||
} | ||
|
||
article [id]:before { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confused a bit here -- why do we need this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, it doesn't need anymore, I'll fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was used to prepend the spacing of the article.
when touching the url with the fragment identifier such as
https://wookay.github.io/Documentery/en/manual/strings.html#man-characters-1
unfortunately, sometimes h2 anchor gets hidden over by topbar.
assets/html/documenter.css
Outdated
z-index: 1; | ||
} | ||
|
||
article table { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, why do we have this one exactly? Maybe you could add a few comments here to explain why/how we need to give some elements special treatment to make sure they render properly on mobile (i.e. so that someone not familiar with mobile UX could get up to speed quickly).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
article table {
table-layout: fixed;
width: 99%;
}
used this to fix the table overflowing such as
https://wookay.github.io/Documentery/en/stdlib/linalg.html#Base.LinAlg.qrfact
thanks a lot for the details!
|
fde237d
to
bbd8c69
Compare
I just found a tool, Sizzy (https://github.com/kitze/sizzy) |
Is this ready to go? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything LGTM now, so could be merged now. Just one final thing about tables.
color: #3091d1; | ||
} | ||
|
||
article table { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tables that should be wide become quite ugly on narrower screens at the moment (e.g. https://sizzy.co/?url=https%3A%2F%2Fwookay.github.io%2FDocumentery%2Fen%2Fstdlib%2Flinalg.html%23Base.LinAlg.qrfact).
Perhaps having overflow-x: auto; display: block;
on a table
would be better? This should allow the user to scroll wide tables instead. Any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated that table styles, it looks much better.
rebased past commits :) |
This is awesome! |
Thank you very much for the contribution, for catering to all my requests and being patient with my slow reviews, @wookay! I think it's a really great addition and we can now finally strike this long standing item off the todo list 😄 |
you're welcome. it is really appreciated at all. |
It's too hard to read the docs on mobile,
I did just make nav.toc to be relative.
Here's an example.
https://wookay.github.io/Documentery/html/
thanks.