-
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
[Data Views] User patterns: Use excerpt as description #60549
[Data Views] User patterns: Use excerpt as description #60549
Conversation
Enable excerpts on the w_block post type. On the Site Editor Pattern pages, use the excerpt as the description for user created patterns.
Size Change: -853 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
I agree, I did not explore those cases because I wanted to keep the initial change small. |
I don't think it is ideal that the description is announced together with both the pattern name and the editing instructions. I found this confusing because it is not clear when the name, instructions, and description starts and ends. |
I changed the position of the description and the instructions and added an em dash. But there is still no pause between the pattern name and the description: Pattern name description —Press Enter to Edit, or Delete to delete the pattern., button, group |
Oh, I'm surprised that text is still there. I think it can be removed now as the pattern grid has been completely replaced. It was only present before because there was no way to use the keyboard to reach the delete button. These days you can tab through every focusable element in the list. In my testing, the delete key also no longer works, so there's that too. |
On the Editor > Patterns screen, patterns that are not created by users does not have their description announced to screen reader users, nor visibly through a tooltip or similar. The description should be announced in the same location on all types of pattern, because inconsistencies will make the pattern screens more difficult to use. Related to but not caused by #60653 I could open a separate issue, but since the description really should be in one consistent location, it could be fixed in this PR if we can agree on a better way to announce it. This PR would be blocked until that is solved... |
- Removes the instructions from `ariaDescribedBy`, since they were not working and are not needed anymore. - Because only one piece of content is added to `ariaDescribedBy`, the `ariaDescriptions` array and the `.map()` are not needed anymore, and are removed.
I don't know what has already been tried. Could we not use the button for all pattern types and parts and make sure the preview is always focusable, but disable the button with |
- Remove the condition that hides the item description on non user patterns. - Use the button for all pattern types and for parts. Disable the button for patterns that are not editable. - Add a title attribute on the non user patterns, to try to avoid confusion for sighted users that clicks the disabled button.
Thanks for the PR! I haven't checked the code yet, but I thought I'd share some first thoughts.
We are working towards removing the details sidebar, so we shouldn't be adding anything new there. The goal is to move things in the inspector controls sidebar and there are designs for excerpt too.
I think that's fine if the buttons is disabled properly. I'd do it separately though the style changes it needs are a lot (that's my impression).
I didn't know about that. Maybe remove it here, so it the announcement is not confusing? |
@ntsekouras, do you have a link to an issue or the design file referenced here? The pattern description is a request several of my clients have had, so I'm curious how it would appear without the details sidebar. |
Designs about the move of excerpt are here: #59689 |
When the pattern is not editable:
That different things happen when you click on different types of patterns is not a great experience. Things to consider:
|
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.
I've left a couple of small comments, but this looks good to me. With this PR and when the excerpt update PR lands, we'll also have the proper labelling (description
).
A follow up could be to update the patterns list (Data Views) to add this field.
Rename blocks.php to post.php. Remove the title attribute from the button. Reset the cursor style to the default when the button is disabled.
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, thanks!
An issue that I observed is the display of the preview in table
view is different between the patterns that are editable and the ones that are not. This is on trunk too, so we could land this and follow up with that. I'll cc @jameskoster if he can come up with some quick css to handle that.
Good spot @ntsekouras, I pushed a fix. |
Trac ticket: https://core.trac.wordpress.org/ticket/61250 |
The purpose is to enable using the excerpt as a description for user-created patterns on the Site Editor Pattern screens. This commit backports the original PR from Gutenberg repository: * [[https://github.com/WordPress/gutenberg/pull/60549|#60549: [Data Views] User patterns: Use excerpt as description]] Reference: [[https://github.com/WordPress/gutenberg/issues/55244|#55244: Patterns: Add descriptions to user-created patterns]]. Follow-up to [44146], [44150], [50835], [56030]. Props poena, ntsekouras, krupalpanchal. Fixes #61250. git-svn-id: https://develop.svn.wordpress.org/trunk@58184 602fd350-edb4-49c9-b593-d223f7449a82
The purpose is to enable using the excerpt as a description for user-created patterns on the Site Editor Pattern screens. This commit backports the original PR from Gutenberg repository: * [[https://github.com/WordPress/gutenberg/pull/60549|#60549: [Data Views] User patterns: Use excerpt as description]] Reference: [[https://github.com/WordPress/gutenberg/issues/55244|#55244: Patterns: Add descriptions to user-created patterns]]. Follow-up to [44146], [44150], [50835], [56030]. Props poena, ntsekouras, krupalpanchal. Fixes #61250. Built from https://develop.svn.wordpress.org/trunk@58184 git-svn-id: http://core.svn.wordpress.org/trunk@57647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The purpose is to enable using the excerpt as a description for user-created patterns on the Site Editor Pattern screens. This commit backports the original PR from Gutenberg repository: * [[https://github.com/WordPress/gutenberg/pull/60549|#60549: [Data Views] User patterns: Use excerpt as description]] Reference: [[https://github.com/WordPress/gutenberg/issues/55244|#55244: Patterns: Add descriptions to user-created patterns]]. Follow-up to [44146], [44150], [50835], [56030]. Props poena, ntsekouras, krupalpanchal. Fixes #61250. Built from https://develop.svn.wordpress.org/trunk@58184 git-svn-id: https://core.svn.wordpress.org/trunk@57647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
Enable descriptions for user created patterns by using the excerpt field.
Partial for #55244
Why?
User created patterns did not have an option to add descriptions. Text only descriptions are important for users who are unable to see or interpret the content in the pattern preview.
How?
This PR:
wp_block
post type (This PHP change will eventually need a backport tocreate_initial_post_types()
in wp-includes / post.php).convertPatternPostToItem
and assigning it to the description.Todo:
The PR does not populate the excerpt field with the description when a theme or plugin pattern is duplicated into a user created pattern.
Testing Instructions
The excerpt field can be tested both with a classic theme and block theme, when creating a new pattern or editing an existing pattern. The field should show in the "Pattern" sidebar panel, below the categories.
The Site Editor Patterns page can only be tested with a block theme:
Activate a block theme.
Create a new pattern. (It doesn't matter if the pattern is synced or not)
Add an excerpt to the pattern, save.
Go to Editor > Patterns, select "My patterns".
If you have not already done so, activate your screen reader.
Navigate to the pattern that you just created: When you hear that the title of your pattern is announced, it should be followed by the excerpt.
You can also confirm that the excerpt text is output in the markup. It should be printed in a div inside another div with the class
dataviews-view-grid__media
Screenshots or screencast