-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add content only descriptions in dropdown menus for patterns and templates #61127
Conversation
Size Change: +2.18 kB (+0.13%) Total Size: 1.74 MB
ℹ️ View Unchanged
|
092fea8
to
9447fba
Compare
Can work. I wonder if we can tweak the verbiage a bit. Instead of:
perhaps:
|
@jasmussen What do you think about a small tweak for this part? - "Edit the pattern to modify its placement or delete it." |
Even better, ship it. |
Seems like a bug.
99% of the time this has very little practical use. I reckon we could try removing it.
Is "modify its placement" a bit verbose? Could be 'This block belongs to "[pattern-name]", edit the pattern to move or delete it'. |
bc47175
to
318a493
Compare
@@ -1752,14 +1752,16 @@ export function canMoveBlock( state, clientId, rootClientId = null ) { | |||
if ( attributes === null ) { | |||
return true; | |||
} | |||
if ( getBlockEditingMode( state, rootClientId ) !== 'default' ) { |
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.
Move the block editing check earlier so that blocks in the page editor won't be moved (which is expected.)
packages/editor/src/components/block-settings-menu/content-only-settings-menu.native.js
Show resolved
Hide resolved
@@ -0,0 +1,4 @@ | |||
.editor-content-only-settings-menu__description { | |||
padding: $grid-unit; | |||
min-width: 235px; |
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.
An arbitrary width to match the current menu's width with icons.
packages/edit-site/src/components/template-part-converter/index.js
Outdated
Show resolved
Hide resolved
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. |
318a493
to
2bdd5f2
Compare
Flaky tests detected in 04ba4e8. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8920800995
|
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.
This looks great, it's a really nice affordance to explain the various modes to users.
I noticed three things that I think are bugs.
One I mentioned in a comment. If you have a contentOnly locked group, the wrong template message shows in a dropdown, which is incorrect. Might need more design feedback on that aspect to know what to show:
The second is that when editing a pattern, button blocks with overrides show the 'Add before'/'Add after' buttons, which isn't something that will work:
The third is that when editing a page, blocks like 'Title', 'Featured Image' and 'Content' show the Convert to Template Part option, which I imagine is not desirable and it probably also wouldn't work as those blocks are not replaceable:
packages/editor/src/components/block-settings-menu/content-only-settings-menu.js
Outdated
Show resolved
Hide resolved
<Text | ||
variant="muted" | ||
as="p" | ||
className="editor-content-only-settings-menu__description" | ||
> |
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.
This might be something to consider the accessibility of. I don't know how discoverable text would be in a menu like this. It might be fine, or it might be better to also announce the message as an aria-description or something, that's something that might need further feedback.
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.
Good point. This may need to be a more standard popover rather than a menu
.
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.
@kevin940726 is it feasible to move the text outside of the role="menu"
container, and give it a different role
?
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 don't think it's easily achievable 🤔. Do you think it can be done in a follow-up?
I think I fixed this back in f824d5a. Can you still reproduce it? |
These two are fixed in 8b4ae5e. |
The wordings are not final. We can work on that or push a follow-up PR if we haven't decided yet. Both sound good to me! |
This particular example reads a little strange to me. I wonder if this would work better:
Aside from that small tweak I think this is good to try. It feels like a solid improvement on the lock icon to me. |
83a76c9
to
0147d37
Compare
Updated in a4b4877. |
In a767bd1, I updated the text and removed the references of the block names as suggested in #61127 (comment). |
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.
Couple of small comments, but LGTM. The latest design changes are nice 👍
@@ -391,3 +391,22 @@ export function expandBlock( clientId ) { | |||
clientId, | |||
}; | |||
} | |||
|
|||
export const modifyContentLockBlock = |
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'd be good to add a docblock
packages/editor/src/components/block-settings-menu/content-only-settings-menu.native.js
Show resolved
Hide resolved
canInsertBlock: canInsertDefaultBlock || !! directInsertBlock, | ||
canInsertBlock: | ||
( canInsertDefaultBlock || !! directInsertBlock ) && | ||
rootBlockEditingMode === 'default', |
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.
This check turned out to be too restrictive. See #62367.
What?
Based on #61012. Implement the design in #60834 (comment).
Add descriptions for content-only blocks inside patterns or templates in the dropdown menu.
Why?
See #60834.
This is a UI enhancement for content-only blocks. Most of the actions in the original dropdown aren't needed for content-only blocks. We remove them and provide descriptions and links to edit the entities instead.
How?
Hide original actions and inject descriptions for content-only blocks. The wording and the design are still TBD and can be tweaked.
Testing Instructions
For patterns:
For templates:
Screenshots or screencast
Patterns:
Templates: