-
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
Make the Templates list customized info accessible #42589
Conversation
Size Change: -2 B (0%) Total Size: 1.26 MB
ℹ️ View Unchanged
|
template.author && | ||
template.has_theme_file && | ||
( template.origin === 'theme' || | ||
( ! template.origin && | ||
[ 'theme', 'custom' ].includes( template.source ) ) || | ||
template.origin === 'plugin' ) |
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.
It's pretty complicated because this combines all the logic into one, and it might be clearer to extract it into separate variables:
// Templates originally didn't have the 'origin' field so identify
// older customized templates by checking for no origin and a 'theme'
// or 'custom' source.
const isAddedByTheme = template.has_theme_file &&
( template.origin === 'theme' ||
( ! template.origin &&
[ 'theme', 'custom' ].includes( template.source ) ) );
const isAddedByPlugin = template.has_theme_file && template.origin === 'plugin';
const isCustomized = template.source === 'custom';
if ( ( isAddedByTheme || isAddedByPlugin ) && isCustomized ) {
I wonder how the outcome of #42555 affects things here? IE if we make the 'Clear customizations' action visible, then we may not need the 'has been edited' indicator since that is implied by the existence of the aforementioned button. |
Thanks all for your feedback. I'd agree this needs to wait for the outcome of #42555 |
I'm going to close this PR in favor of #47841 where I tried to follow the suggestion from #42555 (comment) and group the templates in two separated tables. |
Fixes #42557
What?
In the Templates list, makes the indication of whether a template has been customized accessible to all users.
Why?
The 'blue dot' and tooltip to indicate a template that has been customized by a user are not accessible. The tooltip is only shown on hover, thus isn't accessible to keyboard users and screen reader users. There's no other textual information available. Also, this is a data table. The 'Added by' column should only contain the data type indicated by the column header: who/what added the template. Instead, the 'customized info' is more related to the template state. The first column seems a more appropriate place for this information, as it's more a generic data type about the 'template details' (name, description, and state).
How?
Split the 'customized info' to a separate component that renders visible text in the first column.
There are several conditions in the logic to determine whether a template has been customized by a user. Previously, one of the conditions was based on (no)
imageUrl
. I changed it to 'if there is a template author'. The other conditions are unchanged. I'd appreciate some help to check if this is correct. Cc @talldan 🙏Testing Instructions
Screenshots or screencast
Before:
After: