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

Widgets should be more responsive #333

Closed
JDGrimes opened this issue Jun 11, 2015 · 17 comments
Closed

Widgets should be more responsive #333

JDGrimes opened this issue Jun 11, 2015 · 17 comments
Assignees
Milestone

Comments

@JDGrimes
Copy link
Member

The logs tables in the widgets can easily look bad on skinny sidebars (or just any average sidebar, really). We should make them more responsive, so that they look better by default. We may also want to consider adding some settings that will allow them to be styled.

@JDGrimes JDGrimes added this to the 2.0.0 milestone Jun 11, 2015
@JDGrimes JDGrimes modified the milestones: 2.0.0, 2.1.0 Jun 27, 2015
@JDGrimes JDGrimes modified the milestones: 2.1.0, 2.2.0 Aug 1, 2016
@JDGrimes JDGrimes modified the milestone: 2.2.0 Nov 9, 2016
@JDGrimes JDGrimes added this to the 2.3.0 milestone Dec 9, 2016
@JDGrimes JDGrimes self-assigned this Feb 13, 2017
@JDGrimes
Copy link
Member Author

JDGrimes commented Feb 13, 2017

Here is an example of the Points logs screen right now on TwentySeventeen TwentyFifteen:

wordpress_develop_ just_another_wordpress_site-_2017-02-13_09 37 59

There are several different strategies that we could use here. The most obvious is hiding columns. Although we could also determine a sane minimum width of the table and let users scroll. Or we could have a minimum and automatically display the overflow on hover. That could become annoying though. Not sure what experience would be best on mobile.

@JDGrimes
Copy link
Member Author

Here is what it looks like with the description hidden:

wordpress_develop_ just_another_wordpress_site-_2017-02-13_09 46 45

With the time hidden:

wordpress_develop_ just_another_wordpress_site-_2017-02-13_09 47 19

With the points and time hidden:

wordpress_develop_ just_another_wordpress_site-_2017-02-13_09 48 10

The problem with hiding columns though is that different columns will have priority for different people, probably. So just doing this automatically is probably not going to work well. It would be better to give users the option as to which columns to show in the widget.

@JDGrimes
Copy link
Member Author

Using scrolling instead, with a minimum width of 500px:

wordpress_develop_ just_another_wordpress_site-_2017-02-13_10 11 01

wordpress_develop_ just_another_wordpress_site-_2017-02-13_10 11 26

Some users may prefer this, but it is really not the best experience not to be able to see all the information at once. So maybe it should be another option for users, but some folks would probably rather hide columns than have it use scrolling.

@JDGrimes
Copy link
Member Author

The option of having it fly out looks like this:

wordpress_develop_ just_another_wordpress_site-_2017-02-13_11 08 42

This is nice, however, it has the most potential issues. Small screens, different background colors, z-index issues, etc. It may have its place, but for some users it would just be asking for bugs.

@JDGrimes
Copy link
Member Author

Here is what the widget looks like in the Customizer with the option to disable each column:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-13_15 03 12

And here is what it looks like with the additional option of forcing horizontal scrolling:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-13_15 35 55

I toyed with the idea of also letting the user set a width here, but after further reflection I decided against it, because I am trying to avoid inline CSS (everything being done with classes on the table right now). So I just let it default to 500px.

@JDGrimes
Copy link
Member Author

Something that I noticed was that the table columns are being forced to all be the same width, despite the fact that they contain disproportionate amounts of content. This is a result of the default styling for tables in TwentyFifteen including table-layout: fixed;. In this case, I think it makes sense for us to set table-layout: auto for this table, regardless of how a theme wants to display tables by default. It does wonders:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-13_15 37 46

@JDGrimes
Copy link
Member Author

Y'know, another thing that we could do here is hide the user names and only display the avatars. Again, that is something that could be controversial, but we might want to give users that option. I don't think that there is a good way for us to just hide the text, we'd have to wrap it in a span that we can target with CSS. Probably that's a good idea anyway.

@JDGrimes
Copy link
Member Author

Here is what it looks like with the usernames hidden:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-13_17 00 06

Obviously, this is something that will only be useful on sites where most people have their avatar set.

@JDGrimes
Copy link
Member Author

So much for the points logs widget. Let's consider the other widgets now.

Here is what the Top Users widget looks like right now on TwentyFifteen:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-13_17 11 53

Just adding table-layout: auto does it good:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-13_17 09 27

Really, I'm not sure that we need to do much else beside that for it right now. Although some users do want the option to hide the rank, maybe we should make that an option for this widget.

@JDGrimes
Copy link
Member Author

Or maybe we should just not display the rank title of the users in the widget by default. Decisions, not options. It would break back-compat in UX, but the fact is that we've had several requests to not display it, probably for the very reason that it doesn't do well in the widget.

Here is what it would look like:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-13_17 37 40

@JDGrimes
Copy link
Member Author

Another improvement would be to change the title of the Position column, since the length of that word makes the entire column wider. Something like this is better (though we'd need to still have screen-reader text for a11y):

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-14_10 29 37

@JDGrimes
Copy link
Member Author

I also noticed that there is a double-border along the top of each row. It turns out that this is a part of our CSS for the table, and I'm not sure why. It doesn't appear to be needed here though. Perhaps it was designed in a theme that didn't have borders between table rows, and we thought that was bad. But really, that is a design decision I think that we can safely leave up to theme authors. It looks better:

wordpress_develop_ just_another_wordpress_site-_2017-02-14_16 28 01

@JDGrimes
Copy link
Member Author

I missed the border on the bottom of the table in that screenshot. Also, we apparently had some extra padding in the cells also, which isn't necessary (unless a theme is not styling tables at all). It looks like these styles go all the way back to the beginning, so I have no clear idea why I originally added them anyway. Removing them expands the padding just slightly on TwentyFifteen:

wordpress_develop_ just_another_wordpress_site-_2017-02-14_16 37 26

@JDGrimes
Copy link
Member Author

Now on to the My Points widget. Here is what it currently looks like:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-14_16 58 38

I guess for consistency with the Points Logs widget, we should add the column hiding and horizontal scrolling options.

@JDGrimes
Copy link
Member Author

To reduce duplication, I've decided to extend the points logs widget here. I've also decided to just go ahead and give users the option to display the user column if they want to here as well. In the process I realized that the horizontal scrolling option (and the hide usernames option) were not able to be turned off, and fixed this in the update() method. What it looks like now, with and without scrolling disabled:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-14_17 56 02

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-14_17 47 08

I guess if we are going to enable the display of the user column here, we might want to enable the hiding of usernames as well, though I doubt that the option to display the user column is likely to be used often. I could be wrong though.

@JDGrimes
Copy link
Member Author

Final cut:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-15_09 06 16

@JDGrimes
Copy link
Member Author

Note that because of the way that we had to set the overflow-x CSS property on the wrapper div to scroll at all times (because there is no parent selector in CSS), with the table-layout set to auto instead of fixed, scrolling will sometimes automatically be enabled, even when the setting is disabled:

customize_wordpress_develop_ just_another_wordpress_site-_2017-02-15_09 59 37

That is all the options we have with table-layout though, so I guess we'll have to live with it. It is actually a good thing, I suppose, as otherwise the overflow would just jut out over/under whatever was beside the sidebar.

JDGrimes added a commit that referenced this issue Feb 15, 2017
The table can quickly become cramped on small sidebars, especially the description column. To alleviate this, we give the user some more options in regard to how the table is displayed:

- We allow the user to hide any of the columns of the table via the widget settings.
- We allow horizontal scrolling to be forced an teh table width to be set at 500px.

In addition, we make sure that the table does not used fixed layout, since that isn't a good experience for the nature of this table. And, we've intentionally done all of this without any inline styles.

See #333
JDGrimes added a commit that referenced this issue Feb 15, 2017
JDGrimes added a commit that referenced this issue Feb 15, 2017
It improves display when a theme normally displays tables with fixed layout.

See #333
JDGrimes added a commit that referenced this issue Feb 15, 2017
This improves the display in the widget, which is often cramped.

We define the `.screen-reader-text` class styles for ourselves, which are not guaranteed to be defined by all themes.

See #333
JDGrimes added a commit that referenced this issue Feb 15, 2017
These date back to the dawn of WordPoints, but aren't really needed.

See #333
JDGrimes added a commit that referenced this issue Feb 15, 2017
On many themes the widget areas are too cramped to present data in a table like this when there is too much of it. Showing the rank is probably best left out of there by default.

See #333
JDGrimes added a commit that referenced this issue Feb 15, 2017
This allows us to easily take advantage of the new options added to the logs widget to improve display on skinny sidebars.

The `widget_body()` method of the points logs widget is now more configurable via class properties. And the `form()` method is broken up into several different functions for each set of fields, for easier sub-classing.

In the process a bug in the saving of the horizontal scrolling and hide user names options was discovered, that prevented the disabling of these options, and was fixed.

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

No branches or pull requests

1 participant