-
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
Focus control in widgets customizer #31308
Conversation
Size Change: +597 B (0%) Total Size: 1.31 MB
ℹ️ View Unchanged
|
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 works really well @kevin940726.
Only thing I noticed is that when moving a block to a new widget area, the block isn't always focused. I think we can still move forwards with merging and address that after. Clicking the pencil icons is very slick though!
Code structure looks like a nice improvement—at some point it'd be good to follow-up with documentation.
Should we ship this?
Huh, I can't reproduce this! Can you reliably reproduce it? Would appreciate if you can open an issue or leave a comment here 🙏
I'm still working on adding some e2e tests. Then it should be ready for review (and merge). |
I pushed some changes to try to fix that. Please help review it again 🙏 |
Still looks good to me, thanks for adding tests. |
this.setting.bind( this._handleSettingChange.bind( this ) ); | ||
this.api.bind( 'change', this._handleAllSettingsChange.bind( 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.
Move to constructor so that it can still listen to the changes even when it's not active yet.
There are a few conflicts now after #31405 was merged, |
67cc663
to
76cf4e8
Compare
a0ba1d1
to
3d52629
Compare
Nice work! |
Description
Close #30897.
Handle focus control in the Widgets Customizer. We listen to the
focus-control-for-setting
event globally and handle expanding the section and focusing on the block.I also revamped the structure a little bit, instead of mounting and unmounting a block editor React tree for each sidebar, we mount one React tree globally (virtually) and use
createPortal
to handle rendering the actual editor to each sidebar. We still have to unmount and remount the editor when switching to another sidebar though, the performance does not improve much. However, I hope that the code is bit more structured and flexible now. One benefit of this approach is that we can now use React context to pass down states down the tree.<MoveToSidebar>
can now be written in a more React-way (if that's a thing).Also upgrade
puppeteer-testing-library
to v0.5.0 (full changelog). This enable us to wait fortoHaveFocus()
to finish.How has this been tested?
Added tests in
customizing-widgets
.Screenshots
Kapture.2021-04-29.at.14.11.49.mp4
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).