WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.4k stars 4.16k forks source link

Truncate filter chips #59696

Open jameskoster opened 7 months ago

jameskoster commented 7 months ago
Screenshot 2024-08-05 at 12 07 49

Codepen including updated metrics and styles.

jameskoster commented 7 months ago

Even if we restrict the number of values to two, and truncate the values, chips can still be quite long:

truncate

This one may be best to finesse in a PR.

jasmussen commented 6 months ago

Can it be "Status is: Published, Pending, +3 more"?

jameskoster commented 6 months ago

I think that's what I suggested above? Show two values then a count for additional.

I think we probably need to truncate the values at a certain point too as some could be very long. Think of custom tags, category names, dates, etc. It would be fine to address that spearately when the need arises though.

jasmussen commented 6 months ago

Right, but perhaps without the eliding 🤔

My take: for those advanced chips that get really long, it's okay that they get really long, because you are building advanced queries. I guess they should still not be so long that a single chip breaks in two and wraps, perhaps that's what you mean about eliding?

Finally, controversial take and would be subject to reduce motion of course: how about a marquee behavior? I.e. if longer than n pixels, bounce the label back and forth, slowly?

jameskoster commented 6 months ago

Ah, the ellipsis was to indicate the truncation of 'Pending review', as an example. We could just shorten that label to 'Pending', but we won't always be able to shorten this way.

I agree it's fine for the number of chips to grow when adding many filters. But I also think there could be a point where the chips themselves become egregiously long, even if we limit the display of values to two or three. For example a filter between dates with a longer date format, and a tag filter:

[Publish date is between: 2024-03-10 10:00:00, 2024-04-11 10:00:00] [Tag contains: Month in WordPress, WordCamp Europe, + 3]

That might be an edge case though, so fine to address later.

jasmussen commented 6 months ago

There has to be a more compact way of showing datestamps than that, across WordPress. But yes, point made. I do believe mobile app stores have scrolling filter chips too.

colorful-tones commented 4 months ago

Hi folks, We are only one week away from the Beta 1 cut-off date for WordPress 6.6. This issue hasn’t seen any movement in a while, so we (the editor triage leads of the 6.6 release) have decided to remove it from the WordPress 6.6 Editor Tasks project board.

jameskoster commented 2 months ago

This still needs some design to handle wrapping:

Screenshot 2024-07-08 at 13 56 23
jameskoster commented 2 months ago

I tried a couple of experiments to explore options here.

Option 1 – Codepen

Screenshot 2024-07-09 at 14 00 16

Option 2 – Codepen

Screenshot 2024-07-09 at 14 03 22

Give we intend to move the filtering UI to a dedicated panel (https://github.com/WordPress/gutenberg/issues/60696) I think option 1 is the way to go. I don't love how much vertical space the filters occupy, but if the user finds them too noisy they can easily be hidden by closing the filter panel.

Option 2 is a good one to have up the sleeve in case the filter panel doesn't work out.