Skip to content

Stack cards horizontally in distribution tab#1259

Merged
rcap107 merged 12 commits into
skrub-data:mainfrom
GaelVaroquaux:horizontal_scrolling
Mar 28, 2025
Merged

Stack cards horizontally in distribution tab#1259
rcap107 merged 12 commits into
skrub-data:mainfrom
GaelVaroquaux:horizontal_scrolling

Conversation

@GaelVaroquaux

Copy link
Copy Markdown
Member

To avoid vertical scrolling in IDEs.

Related to #1257

To avoid vertical scrolling in IDEs
@GaelVaroquaux GaelVaroquaux added the TableReport anything related to the TableReport label Mar 19, 2025

@jeromedockes jeromedockes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot @GaelVaroquaux ! I think this can be nice in notebooks and vs code.

the downside as you mentioned in the issue it does reduce the number of cards we can see at once and force us to scroll horizontally to see them.

when in a full page I think it makes a suboptimal use of space:

screenshot_2025-03-19T19:27:16+01:00

here I would rather not have to scroll

cursor: pointer;
}

.float-left {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we float the bar & buttons? it results in wasting space and looks a bit weird IMO

screenshot_2025-03-19T19:10:05+01:00

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also moving the buttons to the right means there is much less space for the tooltip

screenshot_2025-03-19T19:33:52+01:00

which was one reason for having it on the left

@GaelVaroquaux GaelVaroquaux Mar 19, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vertical space.

This is the user experience, even with the button on the side
image

The table report takes a full screen. I cannot see the line that I have run to generate it. It's really annoying. It's a major usability problem, and TBH a reason for me not wanting to use it.

We can improve the tooltip, but it really does not matter compared the waste of vertical space

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I think that the problem that you flagged cannot happen with the new code that I have committed.

Comment thread skrub/_reporting/_data/templates/column-summaries.css Outdated
Comment thread skrub/_reporting/_data/templates/column-summaries.css Outdated
@GaelVaroquaux

Copy link
Copy Markdown
Member Author

This was meant to be a quick PR so that people told me if the idea was a good one.

This tool is going to be used mostly in IDEs and notebook, so the vertical scaling is crucial (I'm not the only saying this). This is why I moved the button to the side. I'll do it in a cleaner way than the float :).

Yes, we can special case the "open", but it makes the code more complicated and I wonder if we are wasting time on a feature that is almost not going to be used.

@rcap107

rcap107 commented Mar 20, 2025

Copy link
Copy Markdown
Member

I really like this feature, it's far more convenient to use in VSCode now.
Screenshot_20250320_101040

I don't have issues with vertical space either, I had to zoom in a lot to get to the point where the line of code was cut, so that's not a problem on my side.

One thing I noticed is that I was working on the code by looking at the TableReport, then writing something and executing the cell, then going back to the TR to see what else needed doing. That mean I was scrolling up all the time to see the columns and the TR tabs, and this feature addresses the endless scrolling.

@jeromedockes jeromedockes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once the suggestion about relaxing the flex container's width is added

.report-bottom-border {
width: calc(100% - 2 * var(--radius));
border-bottom: var(--border-s) solid var(--color-border-secondary);
margin: var(--spacing-m) auto 0 auto;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can replace --spacing-m with --spacing-s to make it smaller but having the bottom border touch the content looks a bit weird:

screenshot_2025-03-20T10:09:09+01:00

otherwise we can also just remove that border

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, it's that we need to move the "margin" spacing from this container to a "padding" spacing of the enclosed object, else the drop shadow of the cards looks strange here
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to prevent cropping the shadows isn't it easier to keep the margin that used to be around the cards? (it is a bit large but we can reduce it & make it much smaller on top and left)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this padding needed only the statistics and associations panel. I've added it

margin: 0;
/* A bit of space between the bar and the buttons */
.column-selection-buttons {
padding-left: 10pt;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
padding-left: 10pt;
padding-left: var(--spacing-m);

Comment thread skrub/_reporting/_data/templates/column-summaries.css
Comment thread skrub/_reporting/_data/templates/column-summaries.css Outdated
@jeromedockes

Copy link
Copy Markdown
Member

for the buttons, indeed there is not the issue I pointed out anymore. one drawback of having them on the side is that they move when we click them.

we could also consider just removing those buttons and the bar because I don't know how many people would use them (either because they don't need it or haven't figured out what it does)

@GaelVaroquaux

GaelVaroquaux commented Mar 20, 2025 via email

Copy link
Copy Markdown
Member Author

@GaelVaroquaux

Copy link
Copy Markdown
Member Author

For the button:

we could also consider just removing those buttons and the bar because I don't know how many people would use them (either because they don't need it or haven't figured out what it does)

I think that what would be really cool would be to have the button and the bar visible only when the bar is not empty. Ie, clicking on the tickbox would have them show up. Do you know easily how to add this, @jeromedockes ?

GaelVaroquaux and others added 2 commits March 20, 2025 13:13
Co-authored-by: Jérôme Dockès <jerome@dockes.org>
@jeromedockes

Copy link
Copy Markdown
Member

I think that what would be really cool would be to have the button and the bar visible only when the bar is not empty. Ie, clicking on the tickbox would have them show up. Do you know easily how to add this, @jeromedockes ?

yes that's easy to do but the card (and tickbox we are clicking) will jump when we click on the first tickbox (or uncheck the last), and selecting all columns to then remove some becomes check one to make the button appear, then select all. so all in all I'm not sure it's better than the solution in this PR. I suggest we keep as it is in this PR and experiment with that in a separate one

@GaelVaroquaux

Copy link
Copy Markdown
Member Author

I suggest we keep as it is in this PR and experiment with that in a separate one

I agree! :)

I do like the idea of making this not visible by default. It would also decrease the visual crowding, which would be great

@GaelVaroquaux

Copy link
Copy Markdown
Member Author

OK, I think that this is ready for merge

@GaelVaroquaux

GaelVaroquaux commented Mar 20, 2025 via email

Copy link
Copy Markdown
Member Author

@jeromedockes

Copy link
Copy Markdown
Member

That does not work, because it applies to the enclosing element and thus the shadow stop inside the enclosed element, leaving the white margin outside.

I'm not sure I understood 100% what you mean but I still see the shadows being cropped with the current pr's version:

screenshot_2025-03-20T14:19:04+01:00

we can avoid it either by having a margin around the cards

diff --git a/skrub/_reporting/_data/templates/column-summaries.css b/skrub/_reporting/_data/templates/column-summaries.css
index a037513a..bbcbc341 100644
--- a/skrub/_reporting/_data/templates/column-summaries.css
+++ b/skrub/_reporting/_data/templates/column-summaries.css
@@ -9,7 +9,7 @@
     display: flex;
     flex-direction: row;
     flex-wrap: nowrap;
-    gap: var(--spacing-l);
+    gap: 0;
     width: max-content;
 }
 
@@ -25,9 +25,14 @@
 }
 
 .column-summary-group > .card {
-    margin: 0;
+    margin: var(--spacing-s) var(--spacing-l) var(--spacing-l) var(--spacing-l);
 }
 
+.column-summary-group > .card + .card {
+    margin-left: 0;
+}
+
+
 /* Individual column summary cards */
 /* ------------------------------- */
 

screenshot_2025-03-20T14:20:22+01:00

or padding on the parent

diff --git a/skrub/_reporting/_data/templates/column-summaries.css b/skrub/_reporting/_data/templates/column-summaries.css
index a037513a..7aac0e7d 100644
--- a/skrub/_reporting/_data/templates/column-summaries.css
+++ b/skrub/_reporting/_data/templates/column-summaries.css
@@ -11,6 +11,7 @@
     flex-wrap: nowrap;
     gap: var(--spacing-l);
     width: max-content;
+    padding: var(--spacing-s) var(--spacing-l) var(--spacing-l) var(--spacing-l);
 }
 
 /* Increase the gap between buttons & columns to make it clearer the buttons are

screenshot_2025-03-20T14:24:09+01:00

@GaelVaroquaux

Copy link
Copy Markdown
Member Author

I'm fine with your proposed solution as long as it doesn't add too much vertical whitespace. Do you want to send a PR here? I'm totally out of time on this, I did this PR as a quick demo of a solution to the problem, and I'm spending why more time than I can afford on this

@jeromedockes

Copy link
Copy Markdown
Member

just so we have the full discussion here: there are also some comments in

GaelVaroquaux#3

@jeromedockes

Copy link
Copy Markdown
Member

not a big deal but in the first tab also, removing the bottom padding means the column summary card overlaps the border

screenshot_2025-03-21T09:49:16+01:00

@GaelVaroquaux

Copy link
Copy Markdown
Member Author

not a big deal but in the first tab also, removing the bottom padding means the column summary card overlaps the border

screenshot_2025-03-21T09:49:16+01:00

Fun thing: I'm not getting this, it must be a firefox vs chrome difference. Hence the importance of testing on many browsers

And color the cards
@GaelVaroquaux

Copy link
Copy Markdown
Member Author

Card coloring implemented.

This should now be good for review
image

@jeromedockes

jeromedockes commented Mar 21, 2025

Copy link
Copy Markdown
Member

I think we are losing some contrast (unless we also change the text), https://webaim.org/resources/contrastchecker/ complains about these (there may be more):

screenshot_2025-03-21T15:42:42+01:00
screenshot_2025-03-21T15:41:15+01:00

the bar plots & background are also quite close

screenshot_2025-03-21T15:41:36+01:00

and this is a detail but buttons don't match the background anymore, not sure if that's good or bad

screenshot_2025-03-21T15:42:03+01:00

the background color makes it harder to have a good contrast and I'm not sure the benefit it brings makes up for that.

maybe we need to tone them down or change the text color. to avoid delaying the horizontal scroll thing we can also merge it like this and revisit the colors in another pr

@GaelVaroquaux

Copy link
Copy Markdown
Member Author

Ok, can you take over.
I really must be working on the grant proposal

@jeromedockes

Copy link
Copy Markdown
Member

ok the contrast between the text and background should be ok now, @GaelVaroquaux lmk if it's ok for you

@jeromedockes

jeromedockes commented Mar 27, 2025

Copy link
Copy Markdown
Member

I don't think the changes to the bottom border are a big improvement, now it is not centered and it touches the scrollbar. but it's kind of a detail

now:

screenshot_2025-03-27T12:46:16+01:00

main branch:

screenshot_2025-03-27T12:54:31+01:00

(we could reduce the margin without removing it entirely, and also keep the centering)

@jeromedockes

Copy link
Copy Markdown
Member

(closed by mistake)

@GaelVaroquaux

Copy link
Copy Markdown
Member Author

I don't think the changes to the bottom border are a big improvement,

Agreed

.columns-in-sample-tab .card-header {
position: relative;
background-color: var(--color-background-highlight-primary);
border-block-end: var(--border-s) solid var(--color-border-highlight);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeromedockes : do you think that this is the faulty change, regarding the border?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no I think it is this one

if it's ok for you I'll restore the deleted rule it but making the vertical margin much smaller

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but much smaller :).

Thanks!

/* shadows */
--color-shadow: hsl(0, 0%, 63%);
--color-shadow-keyboard: rgb(255, 255, 255, 0.5);
--color-shadow-keyboard: var(--color-border-secondary);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that one is not related to this pr but I noticed it and figured let's fix it here and not do another pr for 2 lines of diff

@jeromedockes jeromedockes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be ok now!

@GaelVaroquaux

Copy link
Copy Markdown
Member Author

@rcap107 : can you check the visuals (eg the rendered docs) and merge if happy?

@rcap107 rcap107 merged commit 82c3251 into skrub-data:main Mar 28, 2025
rcap107 pushed a commit to rcap107/skrub that referenced this pull request Apr 2, 2025
Co-authored-by: Jérôme Dockès <jerome@dockes.org>
rcap107 pushed a commit that referenced this pull request Apr 2, 2025
Co-authored-by: Jérôme Dockès <jerome@dockes.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

TableReport anything related to the TableReport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants