-
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
Widgets: Refactor the inspector in Widgets Customizer to use core's controls #30431
Conversation
Size Change: +715 B (0%) Total Size: 1.42 MB
ℹ️ View Unchanged
|
a41c92e
to
cf187c4
Compare
// This is a temporary hack to prevent button component inside <BlockInspector> | ||
// from submitting form when type="button" is not specified. | ||
<form onSubmit={ ( event ) => event.preventDefault() }> |
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 opened ItsJonQ/g2#298 to track this.
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 PR is merged now. Can we remove the hack?
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 not yet being merged into trunk yet.
I like this approach better 🙂 |
This is an oversight, fixed in c81cbab.
This is a bit weirder, it seems like it has something to do with React remounting the tree twice. Since currently I can't get 2+ block editors work nicely together at the same time on the page, I unmount the previous one whenever it's collapsed and remount it when expanded. I delay the mounting to after the transitioning to avoid the weird transitioning effect, also make it more responsive to user's interactions. If it's not solvable (rendering multiple block editors) at the time, then maybe we should consider adding some loading screen when transitioning 🤔. |
It should be possible. The idea of a |
Oh I didn't know that!
Yes we should be able to, but I think that's up to a different PR. The performance concern is crucial too. I would imagine mounting multiple fully-featured block editors has some serious performance impact, but I need to do some tests to make sure, maybe it's not that bad. |
Yeah, I see what you mean here. I am definitely not a fan of how the editor "pops in" now after the transition is complete. It makes the UI feel very unresponsive. If it is not feasible to mount the entire editor in the 16 ms that we have before the transition starts then we should try to mount only some of the block editor. Perhaps only the block editor's chrome but not the blocks. But, yes, this can be done in a follow-up 🙂 |
Description
Supersede #29755, close #30271.
I essentially rewrote the inspector by using core's controls section. Simplified the code a bit and moved most of the logics to
controls
. This also fixes the accessibility and UX issues of the previous attempt.How has this been tested?
Screenshots
Kapture.2021-04-01.at.10.30.07.mp4
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).