Skip to content

[MRG] CSS: float the download buttons on wide screens#336

Merged
lesteve merged 11 commits intosphinx-gallery:masterfrom
GaelVaroquaux:css_buttons
Jan 9, 2018
Merged

[MRG] CSS: float the download buttons on wide screens#336
lesteve merged 11 commits intosphinx-gallery:masterfrom
GaelVaroquaux:css_buttons

Conversation

@GaelVaroquaux
Copy link
Copy Markdown
Contributor

To make them more visible to users for download

To make them more visible to users for download
@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

Continuation of discussion on #329

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jan 8, 2018

Codecov Report

Merging #336 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #336   +/-   ##
=======================================
  Coverage   91.68%   91.68%           
=======================================
  Files          27       27           
  Lines        1816     1816           
=======================================
  Hits         1665     1665           
  Misses        151      151
Impacted Files Coverage Δ
sphinx_gallery/downloads.py 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77f14c2...415b74b. Read the comment docs.

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

Links to the rendered pages:

And screenshot with default sphinx theme:
sphx-glr

I think that this is a usability improvement compared to what we have.

@GaelVaroquaux GaelVaroquaux changed the title CSS: float the download buttons on wide screens [MRG] CSS: float the download buttons on wide screens Jan 8, 2018
@lesteve
Copy link
Copy Markdown
Member

lesteve commented Jan 8, 2018

Nice! The floating right is a bit weird on the readthedocs theme (which is the one we used in sphinx-gallery.github.io). From this example:

screenshot-2018-1-8 plotting the exponential function sphinx-gallery 0 1 13-git documentation

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

I don't think that it's that bad. What bother's you? That's it's too far on the right?

@lesteve
Copy link
Copy Markdown
Member

lesteve commented Jan 8, 2018

That's it's too far on the right?

Yeah I was wondering if there is an easy way to make it float just a bit right of the example code. If there is no easy way to do that, it's fine with me.

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

GaelVaroquaux commented Jan 8, 2018 via email

* Separate behavior for full gallery and for examples

* For very large screen, avoid sending the buttong too far on the right

* Special case RTD theme
@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

GaelVaroquaux commented Jan 8, 2018 via email

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jan 8, 2018

A bit too late to look at this, but for MNE before #329 we had:

screenshot from 2018-01-08 12-20-29

#329 it broke a bit:

screenshot from 2018-01-08 12-22-12

After this PR (e87efda) it looks just like the above until I make the screen wider, then I get:

screenshot from 2018-01-08 12-28-12

And wider still:

screenshot from 2018-01-08 12-28-26

These problems can be fixed, but it is worth knowing that CSS tweaking can break existing use cases a bit. By customizing our CSS in MNE perhaps we should even expect that upstream changes can do this (maybe we should put it in the docs somewhere if it's not already there?).

This seems to interact nicely when building the SG docs, though -- and thus probably should anywhere CSS is not customized -- so +1 for merge from me.

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

@larsoner : +1 adding a note for saying that customizing CSS is a bit dangerous (it will always be, CSS is unfortunately brittle). Where do you suggest that we add it?

The fix on your side will be easy. In addition, it the latest commit, I've added a new class that you can capture in CSS.

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

GaelVaroquaux commented Jan 8, 2018 via email

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jan 8, 2018

Also here is a possibly different sort of problem with the float -- it can sit on top of the content. It's clearest in MNE:

screenshot from 2018-01-08 12-35-25

But even happens at some widths with the SG builds:

screenshot from 2018-01-08 12-36-35

As for the doc, I'd put it in the "And some things can be tweaked directly in CSS:" here:

http://sphinx-gallery.readthedocs.io/en/latest/advanced_configuration.html

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jan 8, 2018

(I'm still +1 for merge even with this overlap issue, I read that "optimistic merging" article and I figure someone can fix it in a follow-up PR if it's truly irritating)

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

The overlap cannot be fixed. If you think that it is an important problem, we can change the media query so that the behavior switches for larger screens. If people agree that the overlap is a problem they should let me know, and I'll change this behavior.

@lesteve
Copy link
Copy Markdown
Member

lesteve commented Jan 8, 2018

FWIW in Firefox 57 I see an overlap with the text for readthedocs theme in https://341-25860190-gh.circle-artifacts.com/0/home/ubuntu/sphinx-gallery/rtd_html/auto_examples/plot_exp.html even in full-screen window (even if there is plenty of space on the right)

screenshot-2018-1-8 plotting the exponential function sphinx-gallery 0 1 13-git documentation 1

@Titan-C
Copy link
Copy Markdown
Member

Titan-C commented Jan 8, 2018

@lesteve I'm on Firefox 57 and I don't see such overlap on a wide screen window. This PR looks nice enough.
As a side opinion. What if we put this buttons at the head of the document instead of the footer and save ourselves the pain of having a floating element?

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

GaelVaroquaux commented Jan 8, 2018 via email

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jan 8, 2018

What if we put this buttons at the head of the document instead of the footer and save ourselves the pain of having a floating element?

This would be done via changing the ordering of the elements within the HTML template rather than tweaking the CSS, right? If so, -1 on this as it can't be reverted/fixed via CSS.

And add transparency, to minimize the negative consequences of overlay
@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

OK, I worked to reduce the overlap. Here is the link to rendered versions:

I hope that this is good to go. It can still generate some overlap, but minor, and I don't think that it is easy to do less.

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jan 8, 2018

Here is what I get for a few views:

screenshot from 2018-01-08 15-51-21

screenshot from 2018-01-08 15-48-15

This one gets a scroll bar , maybe Chrome is just being weird?

screenshot from 2018-01-08 15-48-19

I'm +0 on this change because it always makes it easier to download files or launch Binder, but depending on the resolution it can either be helpful or harmful for example readability.

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

Darn the scrollbar is strange. Let me see if I can reproduce this and fix it.

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

@choldgraf
Copy link
Copy Markdown
Contributor

I really like this addition, I think having the buttons float to the side definitely makes them more discoverable. +1 for an optimistic merge (though there have been quite a lot of iterations on this one already!) and spot-checking improvements as people have a chance to get to know the new behavior

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jan 9, 2018

LGTM +1 for merge

@lesteve
Copy link
Copy Markdown
Member

lesteve commented Jan 9, 2018

Merging, thanks a lot @GaelVaroquaux !

@lesteve lesteve merged commit 6a19fa9 into sphinx-gallery:master Jan 9, 2018
@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

GaelVaroquaux commented Jan 9, 2018 via email

@agramfort
Copy link
Copy Markdown
Contributor

sorry to come late here but I feel this is not an ideal decision. it makes you use a full column for just a button -> it leads to a lot of white spaces.

It also forces you to use a wide screen

@larsoner
Copy link
Copy Markdown
Contributor

@agramfort the button actually floats to the right, so it should (hopefully!) only use already-unused white white space, and when you decrease resolution, it should automatically float to the bottom.

@agramfort
Copy link
Copy Markdown
Contributor

agramfort commented Jan 17, 2018 via email

@larsoner
Copy link
Copy Markdown
Contributor

Yes I get this behavior too at some resolutions:

screenshot from 2018-01-17 15-31-58

maybe it's an MNE pb though

We do use a width that is larger than the SG build defaults. Not sure how common it will be elsewhere.

@lesteve
Copy link
Copy Markdown
Member

lesteve commented Jan 18, 2018

In full-width, it looks fine for me (Firefox 57 and Chrome). If I start making the window narrower I get something like @larsoner's snapshot. I don't know if there is a better way of doing it.

  • can we float the buttons under the header or at the bottom of the window?
  • lower tech solution, maybe we can add link before the title of the example that links to the download section at the bottom of the page?

Other suggestions more than welcome !

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

GaelVaroquaux commented Jan 18, 2018 via email

@larsoner
Copy link
Copy Markdown
Contributor

In MNE our width comes from using sphinx_boostrap_theme, which sets the column width to 1170px when the width is >= 1200 px, i.e. similar to themes here:

https://bootswatch.com/

So I suspect anyone using sphinx_boostrap_theme in conjunction with sphinx-gallery will have this problem.

In any case, at the MNE end we will either modify our column width, or tweak the floating box behavior to jump to the bottom sooner.

@GaelVaroquaux
Copy link
Copy Markdown
Contributor Author

GaelVaroquaux commented Jan 19, 2018 via email

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

Successfully merging this pull request may close these issues.

7 participants