-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Editor: Display ten most used terms #30598
Editor: Display ten most used terms #30598
Conversation
Testing using WordPress 5.7. Twenty Twenty One. Downloaded a special Gutenberg plugin containing this PR build. This is really nice, George! Thank you! This PR also tackles this issue: |
I will add some issues that would be good to go through before this PR is merged. Bug where tags disappear when adding tags in the create post view #21589 (comment) Tags and FormTokenField disappear when user don't add comma or click Enter Key Suggested tags should be a list |
To create a clearer distinguish between tags. You can add size differences based on how much each tag is used. It is similar to how it looks using the Classic Editor. Btw |
I am wondering if we should stick to the Classic Editor framing the tags. |
It looks like this PR is ready for a code review. |
Going through this PR and to my untrained eye, this looks pretty nice. I do have a UX question, though: Should the "Choose from the most used Tags" button be visible when there are no terms available? Now it is, and I can imagine it can be confusing, because when no terms are available, nothing happens after clicking on the button. We could add a fallback in the form of "You don't have any terms yet, click here to add your first", but that might be a bit redundant, because of the big fat "Add new term" form :) I'd go for hiding the button until there is at least one term to pick. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
); | ||
}; | ||
|
||
function FlatTermSelectorMostUsed( { onSelect, taxonomy } ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minior: should this be extracted to its own file components/post-taxonomies/most-used-terms.js
or something just to keep the size of this file contained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason didn't go with a separate file was to reuse util functions, but it might be a good idea to move them into the utils.js
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed via abfa5ed.
Thank you for the PR! This will be a good one to close, wow. Here's before: Here's after: The specific interaction: The feature is very useful, however the tag cloud as a concept has not scaled well:
The best aspect of the tag cloud is just a ranked list, which seems the simplest possible thing to do. Even something entirely basic like this would be better: If you rebase this PR, the 20 also feels like a LOT of suggestions. Can we do with less? 6? 8? 12? |
@jasmussen Joen here is a link to a discussion on why it is nice to show the tags visually in different sizes: Some of the discussion has to do with having similar named tags. Having a visual difference makes it easier for users to select the correct tags. Brainstorming... I am at present not able to download the special version of the Gutenberg plugin. Option does not show up in the left sidebar in the Checks screen. |
I respect that feedback, but my thoughts stand regardless. I don't see how the perceived benefit of relative sizing outweighs the accessibility downsides. |
The "choose tags..." text, and the tags themselves both appearing as links is confusing, imo. @jasmussen's suggestion looks much better to me: Instead of using font-size to rank the tags, could we just display them in descending order of use? If that's not adequate, each tag could have a suffix that declares it's number of uses:
|
Personally, I have a very hard time telling when terms start and end in the flat format example (probably closest to the "don't create a wall of text" note on the link @jasmussen posted). I like that displaying count (like @jameskoster suggests) would make it clear that they're being ordered by most used, along with providing a delimiter between terms. I wonder if on large sites if that might lead to it looking a bit off due to the length of the number, but I suppose it'd have to be 1000+ posts before it is 4 digits. |
This reverts commit ef1427d.
I should've also clarified that if we were to show just a plain list of tags, they should be sorted in order of usage just like Jay suggested, though I like the addition of the number count.
The tag plus number should probably be its own inline block so you don't accidentally get the number wrapping onto a new line without the preceeding tagname. |
At this point we perhaps we can do something like "2.3k". |
Please check this comment in the issue: (It shows various mockups.) |
bf46940
to
abfa5ed
Compare
Pushed another design updated as suggest by @jasmussen #30598 (comment). The tag cloud is now ranked list that displays the 10 most used terms. The label - "Most Used" comes from the Misc changes:
|
That looks much better, thank you @Mamaduka! This seems definitely shippable. Question: does the interface show up always, even if you have zero or less than 10 tags total? If yes, should we limit it to showing up only when you have more than n tags, say 10? |
Thanks, @jasmussen.
I think it makes sense only to display this component if a site has ten or more tags. I will update the logic. |
I've updated the display logic. |
I am seeing this: I miss having the "Choose from most used tags" text link which earlier opened up to show various tags. The Tags feature has gone so many rounds. Let's just land and merge what we got. Things can be iterated upon if/when needed. Thanks for working on this feature George! |
Thanks, everyone, for testing, reviews, and suggestions ❤️ I'm going to merge the current iteration later today. |
I am just not getting it. Please enlighten me..:) I installed and activated Gutenberg plugin 10.6.0 on a local test site. Most-used-tags.mp4Btw But I expected to see the top used tags. Independent of how many there are. EDIT: |
Description
The new component displays the 10 most used terms under the flat term selector token field. This component is only displayed when a site has ten or more terms with at least one item (post/page/CPT).
I've included accessibility fixes recommended by @afercia, except the usage count of each specific term. I omitted this
aria-label
since terms in the list don't have different sizes or display term count. Ref - https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/category-template.php#L941.Fixes #8867.
Closes #21859.
Props to @olivervw and @grappler for the initial code.
Screenshots
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).