-
Notifications
You must be signed in to change notification settings - Fork 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
Nav Sidebar: use the official slot API to replace close button #43472
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
Caution: This PR affects files in the FSE Plugin on WordPress.com D45184-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing in the FSE Plugin for more info: PCYsg-ly5-p2 |
5798280
to
f4a60f2
Compare
b7409aa
to
3c39447
Compare
f26bae9
to
5f1cd88
Compare
3c39447
to
c25b0ec
Compare
icon={ wordpress } | ||
iconSize={ 36 } | ||
onClick={ toggleSidebar } | ||
></Button> |
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 feel I have contributed something to this code review 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.
I thought prettier would have complained about 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.
tests well for me. noice!
i can't really provide any constructive feedback on the implementation, but the code looks neat. :)
No problem 😆 it's sort of a boring PR to review because it just works like before. Just less hacky. |
Rebasing to pick up latest FSE work. |
Filter no longer needed to coordinate between calypsoify override and nav sidebar override. The slot API means they are now totally different buttons.
c25b0ec
to
ce71022
Compare
Note to anyone reading this while preparing a release of the FSE plugin
This change doesn't require any release notes. We're developing a new feature which is currently hidden behind a flag.
Changes proposed in this Pull Request
Related to #43313, this changes the method the nav sidebar is using to override the (W) button in the top-left corner. It replaces the hacky way of overriding the close button with a new API which was added in WordPress/gutenberg#22323.
<MainDashboardButton>
control to override the editors close buttonregisterPlugin()
function; no longer need to callReact.render()
ourselvesa8c.wpcom-block-editor.shouldCloseEditor
hook which is no longer neededwpcom-block-editor
detects whether the nav sidebar is active and doesn't override the close button if it's enabled. Otherwise the slot API would add two close buttons.We have various other pieces of code at a8c that override the close button (e.g. Jetpack, wpcom). We don't need to worry about them interfering with the nav sidebar because using this slot API means the old button is completely removed.
By removing the
a8c.wpcom-block-editor.shouldCloseEditor
hook the nav sidebar is now entirely independent of wpcom 🎉Testing instructions
Test on dotorg site
cd apps/full-site-editing
yarn build
oryarn dev
WPCOM_BLOCK_EDITOR_SIDEBAR
in.wp-env.override.json
npx wp-env start
http://localhost:4013
(username:admin
, password:password
)Test on dotcom site
widgets.wp.com
and your favouriteWPCOM_BLOCK_EDITOR_SIDEBAR
in sandbox