-
Notifications
You must be signed in to change notification settings - Fork 89
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
Filters: Add prefix label to the single query filters #2804
Conversation
Visually, it looks great. Thanks @ryelle 🚢 |
Ah, I was also working on the same stuff but a different ticket. This is the suggested label update mentioned there:
Option 2 looks better to me. Q: Do we consider removing the label on the dropdown? Maybe it's fine for now and can leave it to post-launch. |
@@ -534,7 +534,7 @@ function get_student_course_options( $options ) { | |||
$label = $options[ $selected_slug ] ?? $options['all']; | |||
|
|||
return array( | |||
'label' => $label, | |||
'label' => sprintf( __( 'Status: %s', 'wporg-learn' ), $label ), | |||
'title' => __( 'Completion status', 'wporg-learn' ), |
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.
Can you change the first letter of "status" to uppercase to make it consistent?
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.
We use sentence case across the site, so leaving "status" lowercase in "Completion status" is correct. "Content Type" and "Skill Level" should probably be updated to "Content type" and "Skill level" instead. Unless I'm using that rule too broadly — maybe a check from @thetinyl would help.
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.
Yes, let's use sentence case. Thanks for checking!
Ah sorry @renintw, I wasn't sure what that ticket was referencing, now I understand. If we went with Option 1, there is no feedback about which item is currently selected, and that info is not exposed anywhere else. So I also think Option 2 is better.
That's a wider question, as the change would happen in the query-filter block itself. I would prefer to decouple that change from Learn. I'm making a companion issue in wporg-mu-plugins right now to track updating this on other sites, I'll add a note about this there. |
Not at all 🙂 Yeah, that's also the reason I prefer Option 2.
I just looked around a bit at how other sites handle this and found an approach that might be good- adding an icon as a prefix to the button label, similar to how we switch GH branches here. The title inside the dropdown doesn't need to be removed in this way. |
Hm, I don't know what icons that would understandably communicate "level" and "type", and icons instead of text can also be an accessibility issue. I've added a note here to address whether the dropdown title should be hidden: WordPress/wporg-mu-plugins#645 |
@ryelle Yes these work for me! |
This might need some feedback from the design team. I was thinking that using an appropriate icon along with text inside the dropdown is also likely to help users get familiar with the filter quickly. And I think the icon can have an aria-label or aria-labelledby to handle the accessibility issue? This isn't a blocker or something that must be done, just thought it might be worth having a preliminary discussion of the possibilities.
Thanks! |
The accessibility issue is more about understanding what the button does, not for screen reader users. For example, a sighted user might see an icon and without knowing what it means, might not click on it. This article has a good overview of accessible icon design & use - "An icon’s design should communicate its function clearly and intuitively, reducing the cognitive load on users." I don't know that there is something universally recognizable for these filters. The github button works a) because we're technical users, and we've seen that icon many times, and b) it's labelled immediately next to the button: From WordPress/wporg-mu-plugins#645, it sounds like this approach + removing the title from the dropdown works, so I'm going to merge this. We can always iterate on it more. |
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.
LGTM 👍 And thanks for sharing that a11y article!
Have we decided to go with the short version? Maybe we should tag Destiny to let her know about the change to her proposal.
c554ece
to
c1bf3b0
Compare
I think so, in the interest of space. I'll comment on the other issue so she can reopen it if that exact text was required. |
return $level->slug === $selected_slug; | ||
} | ||
); | ||
$selected_level = wp_list_filter( $levels, array( 'slug' => $selected_slug ) ); |
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.
💯
Fixes #2784 - this prefixes the single select filters with the filter name, to give it a more accessible name.
cc @ndiego @kathrynwp Do those prefixes make sense? Using the full title for the last two would be too long, IMO, so I went with a short version.
Screenshots:
Learning pathway
Lesson archive (with "Advanced" filter)
Search results
My courses