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

responsive side navigation #449

Merged
merged 1 commit into from
May 7, 2017
Merged

Conversation

wookay
Copy link
Contributor

@wookay wookay commented Mar 16, 2017

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.

@mortenpi mortenpi added this to the 0.10 milestone Mar 20, 2017
@mortenpi
Copy link
Member

Thanks for tackling this. Mobile UX is certainly somethings that's on the todolist. A couple of things that I noticed:

  • We can probably have it be 100% wide on mobile screens, and also drop the shadow thing on the right. I.e. that the menu would cover the whole screen
  • How hard do you think it would be to have the page header show up when the user pulls the page down? I.e. that you wouldn't have to scroll all the way up to open the menu. E.g. something like the Material theme does for MkDocs.

@wookay
Copy link
Contributor Author

wookay commented Mar 21, 2017

We can probably have it be 100% wide on mobile screens, and also drop the shadow thing on the right. I.e. that the menu would cover the whole screen

it's not perfect, added the topbar. see the Julia Documentation example.
https://wookay.github.io/Documentery/en/

How hard do you think it would be to have the page header show up when the user pulls the page down? I.e. that you wouldn't have to scroll all the way up to open the menu. E.g. something like the Material theme does for MkDocs.

then we need more javascript framework like bootstrap. mkdocs looks really good.

@randy3k
Copy link

randy3k commented Apr 11, 2017

It looks very good. Is there any reason of not merging this (besides the merge conflict)?

@mortenpi
Copy link
Member

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.

@mortenpi
Copy link
Member

mortenpi commented Apr 19, 2017

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.

  • Clicking on (touching?) the main page behind the menu should probably close the menu (e.g. how it's done here)
  • If the page is wider than the screen then it breaks a bit, e.g. on the Examples page.
  • Also, if the screen is very wide (e.g. phone in landscape), I feel that the menu probably shouldn't extend to 80%, but only be as wide as the text basically (e.g. the Material theme).
  • The .topbar actually duplicates the <header> tag. Easiest could be to just hide the header in mobile mode. Or alternatively use the header tag for both things. I think it's fine if we drop the "Edit on GitHub" link on mobiles.
    2017-04-19 07 47 03
  • If you're scrolled down and you click on the menu button (), it jumps back to the beginning of the page. Probably would be nice if wouldn't do that.
  • The menu seems to scroll together with the page even if the menu is hidden. Would better if it didn't I think, since in practice this means that you are at the bottom of the menu every time you open it up.

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)))
Copy link
Member

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 divs. 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.

position: fixed;
top: 0px;
left: 0px;
right: 0px;
Copy link
Member

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.

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))
Copy link
Member

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>?


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"])))
Copy link
Member

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 uls 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.

Copy link
Contributor Author

@wookay wookay Apr 20, 2017

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.

@mortenpi mortenpi modified the milestones: 0.10, 0.11 Apr 19, 2017
@wookay
Copy link
Contributor Author

wookay commented Apr 19, 2017

thanks for your reviews! I would investigate it at tomorrow.

@wookay
Copy link
Contributor Author

wookay commented Apr 20, 2017

Fixed almost stuff,
this pr requires headroom.js (http://wicky.nillia.ms/headroom.js)

Copy link
Member

@mortenpi mortenpi left a 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 a position: fixed on article > 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).

@tags div span a

page_title = string(mdflatten(pagetitle(ctx, navnode)))
div["#topbar"](span(page_title), a[".btn .fa .fa-bars", :href => "#"])
Copy link
Member

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.

position: fixed;
width: 100%;
height: 2.7em;
background-color: white;
Copy link
Member

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.

display: block; /* is mobile */
position: fixed;
width: 100%;
height: 2.7em;
Copy link
Member

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 and padding-bottom: 1em on the #topbar.
  • Drop margin-top from div#topbar span and only keep padding-right: 1em for div#topbar a.fa-bars
  • Have an explicit font-size: 1.5em on the div#topbar a.fa-bars (as opposed x-large) -- no other reason than to have an explicit number here.
  • The navlink text will be smaller, so for the #topbar it should also be height: 1.5em.
  • The total height of the #topbar will then be 3.5em, so we should also have a padding-top: 3em on the article, since the default 2em will not be enough.
  • The headroom should also then probably be something like top: -4em.

display: none;
}

article [id]:before {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

z-index: 1;
}

article table {
Copy link
Member

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).

Copy link
Contributor Author

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
screen shot 2017-04-25 at 9 35 49 pm

@wookay
Copy link
Contributor Author

wookay commented Apr 25, 2017

thanks a lot for the details!
I have applied above reviews, and

  • move the div#topbar in the article header.
  • a.fa-bars has padding around 0.6em to enlarge the touch area.
  • media screen max-width 320px's body has the font-size: 15px, because it has a bit different for the iPhone SE on the Safari's Responside Design Mode.

@wookay wookay force-pushed the woo/mobile_css branch 2 times, most recently from fde237d to bbd8c69 Compare April 28, 2017 12:34
@wookay
Copy link
Contributor Author

wookay commented May 3, 2017

@jebej
Copy link
Contributor

jebej commented May 6, 2017

Is this ready to go?

Copy link
Member

@mortenpi mortenpi left a 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 {
Copy link
Member

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?

Copy link
Contributor Author

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.

@wookay wookay force-pushed the woo/mobile_css branch from 53a4db0 to afec9a7 Compare May 7, 2017 06:41
@wookay
Copy link
Contributor Author

wookay commented May 7, 2017

rebased past commits :)

@mortenpi mortenpi merged commit 193a9dc into JuliaDocs:master May 7, 2017
@KristofferC
Copy link
Member

This is awesome!

@mortenpi
Copy link
Member

mortenpi commented May 7, 2017

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 😄

@wookay
Copy link
Contributor Author

wookay commented May 7, 2017

you're welcome. it is really appreciated at all.
I'm happy to help the improvement.

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

Successfully merging this pull request may close these issues.

5 participants