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

Fix Nav Menu overflow using flex-wrap approach #18431

Merged
merged 3 commits into from
Dec 3, 2019
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
28 changes: 28 additions & 0 deletions packages/block-library/src/navigation-link/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,33 @@
}

.wp-block-navigation-link {
margin-right: $grid-size;
// Provide a base menu item margin.
// This should be the same inside the field,
// and the edit container should compensate.
// This is to make sure the edit and view are the same.
padding: 0 $grid-size;
padding-right: 55px; // allow space for Block "mover"

.block-editor-block-list__layout {
display: block;
margin: $grid-size;
}

// Only display inner blocks when the block is being edited.
.block-editor-inner-blocks {
display: none;
}

&.is-editing,
&.is-selected {
min-width: 20px;
}

&.is-editing .block-editor-inner-blocks {
display: block;
}

&.has-link .wp-block-navigation-link__content {
border-bottom-style: solid;
border-bottom-width: 1px;
Expand All @@ -55,6 +77,12 @@
}
}

[data-type="core/navigation-link"] {
.block-editor-block-toolbar {
left: 15px;
}
}

.wp-block-navigation-link__nofollow-external-link {
display: block;
}
Expand Down
12 changes: 10 additions & 2 deletions packages/block-library/src/navigation/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@
.wp-block-navigation .block-editor-inner-blocks > .block-editor-block-list__layout {
margin-left: 0;
margin-right: 0;

}

// 2. Remove paddings on subsequent immediate children.
.wp-block-navigation .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block {
width: auto;
padding-left: 0;
padding-right: 0;
margin-left: 0; // something
margin-left: 0;
margin-right: 0;
margin-bottom: 1em; // Useful for when items wrap.
}

// 3. Remove margins on subsequent Edit container.
Expand All @@ -28,6 +31,11 @@
margin-bottom: 0;
}

.wp-block-navigation .block-editor-block-list__block-edit::before {
left: 0;
right: 0;
}

// Remove the dashed outlines for child blocks.
&.is-hovered .wp-block-navigation .block-editor-block-list__block-edit::before,
&.is-selected .wp-block-navigation .block-editor-block-list__block-edit::before,
Expand Down Expand Up @@ -57,7 +65,7 @@
.wp-block-navigation .block-editor-block-list__layout,
.wp-block-navigation {
display: flex;
white-space: nowrap;
flex-wrap: wrap;
}

.wp-block-navigation__inserter-content {
Expand Down