-
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
Gutenboarding: Collapse launch button + plugin icons on mobile #49079
Gutenboarding: Collapse launch button + plugin icons on mobile #49079
Conversation
Caution: This PR affects files in the Editing Toolkit Plugin on WordPress.com D55692-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing the Editing Toolkit Plugin for more info: PCYsg-ly5-p2 |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Webpack Runtime (~42 bytes added 📈 [gzipped])
Webpack runtime for loading modules. It is included in the HTML page as an inline script. Is downloaded and parsed every time the app is loaded. App Entrypoints (~80 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~3827 bytes removed 📉 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~44 bytes removed 📉 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
apps/editing-toolkit/package.json
Outdated
@@ -126,7 +129,7 @@ | |||
"@wordpress/html-entities": "*", | |||
"@wordpress/i18n": "*", | |||
"@wordpress/icons": "*", | |||
"@wordpress/interface": "^0.7.5", | |||
"@wordpress/interface": "^1.0.0", |
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.
We need to double check this package upgrade wont negatively impact other features that are using 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.
I think there recently was packages upgrade so rebasing might sort 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.
@wordpress/interface
was replaced by @wordpress/edit-site
in the toolkit in #48729, so I'd say that upgrading to 1.0.0 shouldn't cause any regressions.
</Button> | ||
) } | ||
renderContent={ () => ( | ||
<div className="dropdown-content"> |
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.
These components may require additional props which we will also need to look into. You can find their usages here in Gutenberg
I'm personally very wary of introducing new .com-only UI patterns, especially considering that this issue is as valid on .com as it is on .org — maybe even more, as .org users might be more inclined to install dozens of plugins adding their icons to the header. I also fear that this approach might prove to be too complicated to maintain, given the amount of variations the editor header can have. What about draft posts? What about the non-post editors? As a quick stop-gap, we might want to start by simply hiding the plugins icons, which are still accessible through the More menu. Fixing the header actions (switch to draft, preview, update/publish) is more difficult, as they don't exist anywhere else, and aren't semantically strictly related. tl;dr: why not just hide the plugin icons for now? |
wp_localize_script( | ||
'a8c-fse-editor-header-buttons-script', | ||
'wpcomEditorSiteLaunch', | ||
array( | ||
'locale' => determine_locale(), | ||
) | ||
); |
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 like it was copy/pasted from another php
file, but we don't need it here. This code adds a window.wpcomEditorSiteLaunch.locale
global, but that global is not used by the editor header buttons.
We should delete these lines.
The iPhone 8 layout works with just the plugin icons hidden
I agree with this. Hiding the plugin icons fixes the layout issue and doesn't get us into the sticky situation of moving DOM items around. This has been flakey in the past and caused crashes in the past (if we manually update the DOM then React can break if it ever tries to re-render the header). Also sometimes the launch button is shown in the header and we'd need to duplicate all the logic for that too. |
If we do just hide the plugin buttons then I think all this PR needs is this bit: @import '~@wordpress/base-styles/mixins';
@import '~@wordpress/base-styles/variables';
@import '~@wordpress/base-styles/breakpoints';
.interface-pinned-items > button:not(:first-child) {
@media ( max-width: $break-medium ) {
display: none;
}
} I'll post about this to make sure happiness are aware of what's coming up. |
58df346
to
e321d43
Compare
A temporary fix has been merged in #49329 instead. There's also a fix for the underlying problem in WordPress/gutenberg#28521 and WordPress/gutenberg#28526 that'll be shipped in GB 9.9 |
Changes proposed in this Pull Request
Testing instructions
apps/editing-toolkit
and runyarn dev --sync
Before
After
Video: https://www.loom.com/share/2709f1194d5a4e48b2fe154179089051
Fixes #48337