-
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
Fix showing double icons for connected blocks in pattern editor #62317
Conversation
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. |
Size Change: +122 B (+0.01%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
{ isUsingBindings && | ||
hasPatternOverrides && | ||
canBindBlock( blockName ) && ( | ||
<BlockBindingsIndicator clientIds={ blockClientIds } /> | ||
) } |
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 think the BlockBindingsIndicator
should be visible when using other types of bindings (e.g. meta) outside of the pattern block, so by adding hasPatternOverrides
to the condition does it prevent that?
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. I just pushed 5ebaab8. It'll show double icons for post meta but I guess we need that for now?
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.
Hmm, now I'm not sure what's expected for bindings. It should be one block icon, and I guess a purple one?
I'm not completely up to date on the block bindings UI changes, so would be good to get some confirmation.
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.
Until now, the purple icon was just a connection icon.
I can see a duplicated icon in trunk
now, I guess since the linked pull request. I would personally keep the current UX showing the connection icon rather than the duplicated one, and figure out later how to keep evolving the UX based on feedback. But it'd be great to hear from @richtabor and @jasmussen .
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 prefer the after here, honestly. We've tried out the connection icon in this iteration in trunk for a bit, but it hasn't felt like it added clarity. I think there are other things we can do, but for now, I'd omit it.
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.
That looks right to me, yes. The "This block is connected" message can be integrated into the transforms dropdown if need be.
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.
Perfect 🙂 @kevin940726 Let us know if it makes sense, if you plan to work on that, and if you need any 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.
Thanks! I'm working on it now. Will push a commit soon!
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 just pushed c862489. It now has the following UI:
Pattern overrides connected block in focus mode:
Pattern overrides connected block in post:
LMK if I miss something!
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.
Regarding the UX, I believe it is much better now! Thanks for working on it. I'll take a look at the code asap.
Flaky tests detected in c862489. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9415176442
|
I removed the backport label until we reach a design decision, and I'll add it back when it's merged. |
Should this be backported for WP 6.6? If so, please add the |
1b51b08
to
c862489
Compare
@@ -22,13 +22,10 @@ import useBlockDisplayTitle from '../block-title/use-block-display-title'; | |||
|
|||
export default function BlockBindingsToolbarIndicator( { clientIds } ) { |
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.
If I am not mistaken, this component becomes specific to pattern overrides because it is only used when adding a pattern in a post, right? Maybe we can rename it and slightly change the implementation to reflect that?
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.
On second thought, I don't think this even belongs in the block-editor
package 😅. I'd imagine it'll be a bigger refactor if we figure out a way to move it to the patterns
package though. I'd prefer to do it in a follow-up PR if necessary. WDYT?
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.
Moving it to the patterns
package seems logical to me 🙂 And I guess it is okay to do it in a follow-up PR. Should we create an issue or something to ensure it is not lost?
Maybe it is still worth changing the component name to clarify it is related to patterns and not block bindings until that PR is done?
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.
Done in 72d0a8e! I renamed some stuff, so could appreciate a final review to ensure I didn't break anything 😆.
@@ -118,6 +121,17 @@ function BlockSwitcherDropdownMenuContents( { | |||
</p> | |||
); | |||
} |
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'm wondering if we could get isUsingBindings
from this useSelect
. Something similar to what is being done here.
If we do this, I believe we could avoid passing isUsingBindings
to BlockSwitcher
and BlockSwitcherDropdownMenuContents
components.
Additionally, I think we wouldn't need isUsingBindings
in the block toolbar anymore (here) and we could just have something like hasPatternOverrides
, as it is now specific to pattern overrides, right?
I am not 100% sure if it makes sense, but maybe it is worth taking a look.
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 believe so, yes! However I don't think it makes much difference. Currently we still need isUsingBindings
in block toolbar to apply the is-connected
class name. We can somehow move the class name to block switcher, but in terms of performance I don't think it matters that much. Do you think it's worth exploring?
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 wasn't thinking about performance but about readability, but I don't have a strong opinion, so whatever you decide it's okay for me 🙂
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 think it reads okay for me, but I'm obviously biased 😅. Happy to do some further improvements if we find something confusing later! 🙇
c702ddb
to
72d0a8e
Compare
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 tested it, and everything seems to be working as expected. Thanks for working on it!
…Press#62317) Co-authored-by: kevin940726 <kevin940726@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> * Fix showing double icons for connected blocks in pattern editor * Fix post-meta * Unify the experience * Rename the component
Co-authored-by: kevin940726 <kevin940726@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> * Fix showing double icons for connected blocks in pattern editor * Fix post-meta * Unify the experience * Rename the component
Co-authored-by: kevin940726 <kevin940726@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> * Fix showing double icons for connected blocks in pattern editor * Fix post-meta * Unify the experience * Rename the component
I just cherry-picked this PR to the wp/6.6-beta-3 branch to get it included in the next release: a052b4c |
Co-authored-by: kevin940726 <kevin940726@git.wordpress.org> Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org> Co-authored-by: jasmussen <joen@git.wordpress.org> Co-authored-by: richtabor <richtabor@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> * Fix showing double icons for connected blocks in pattern editor * Fix post-meta * Unify the experience * Rename the component
What?
Continued from #61560. Fix #61560 (comment).
Prevent double icons from showing when editing the synced pattern itself.
Why?
Showing double icons is confusing to the users.
How?
Only show the binding indicator when editing an overridable pattern as suggested in the issue.
Testing Instructions
Screenshots or screencast
Before:
After: