Skip to content
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

[Gutenberg 7.7.1]: Fix editor header layout issues on mobile & tablet view. #40361

Merged
merged 1 commit into from
Mar 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ const PostContentBlockAppender = compose(
};
} )
)( ( { rootClientId, showInserter } ) => {
const inserterToggleProps = { isPrimary: true };
return (
<Inserter rootClientId={ rootClientId } disabled={ ! showInserter } position="bottom right" />
<Inserter
rootClientId={ rootClientId }
disabled={ ! showInserter }
position="bottom right"
toggleProps={ inserterToggleProps }
/>
);
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,10 @@
margin: 0;
}
}

@media ( max-width: 600px ) {
// Table of contents button is not displayed in mobile view.
.components-dropdown.table-of-contents {
display: none;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
display: flex;
align-items: center;
padding: 9px 10px;
margin-left: -8px;
// Close button override doesn't need the extraneous left-padding
// provided by .edit-post-header__toolbar from WP. So here we
// offset the -24px padding and then restore the 24px padding
// for other toolbar buttons that comes after this button.
margin-left: -24px;
margin-right: 24px;
border: none;
border-right: 1px solid #e2e4e7;

Expand Down Expand Up @@ -46,6 +51,15 @@
.close-button-override-thin {
display: flex;
}
}

// Back button is not displayed in mobile & tablet view.
@media ( max-width: 782px ) {
display: none;
}

// Hide label to make room for others
@media ( max-width: 960px ) {
.close-button-override__label {
display: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,26 @@
}
}

// For Gutenberg < 7.7
@media ( min-width: 600px ) {
body.is-iframed.is-fullscreen-mode .edit-post-header {
top: 0;
}
}

// For Gutenberg >= 7.7
// 782px is $break-medium in Gutenberg which is
// the starting breakpoint for tablet view.
@media ( max-width: 782px ) {
// In non-iframed version, top: 46px is provided to accommodate #wpadminbar.
// On fullscreen mode, #wpadminbar is visible on tablet & mobile voew because
// fullscreen mode actually don't exists on tablet & mobile view.
// See: https://github.com/WordPress/gutenberg/pull/13425
body.is-iframed.is-fullscreen-mode .block-editor-editor-skeleton {
top: 0;
}
}

body.is-fullscreen-mode {
.edit-post-editor-regions,
.components-editor-notices__dismissible {
Expand All @@ -31,3 +45,14 @@ body.is-fullscreen-mode {
.components-notice-list {
z-index: 29; // Ensure notices are placed behind the editor header (z-index: 30).
}

// The parent element .edit-post-header__toolbar provides
// a padding-left of 24px. However, the right side of the header
// only has a padding-right of 16px.
//
// To make the toolbar buttons look more balanced, an left offset of -8px
// is added to this custom block inserter button (24px - 16px = 8px). This
// -8px offset also contributes in solving spacing issue in mobile/tablet view.
.block-editor-inserter__toggle {
margin-left: -8px;
}