Skip to content

Commit ff7a8d5

Browse files
committed
Better behavior for hidden blocks
1 parent 465777d commit ff7a8d5

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

packages/block-editor/src/components/block-list/content.scss

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,25 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
9393
}
9494
}
9595

96+
97+
// Hidden blocks.
98+
// In order for the block toolbar to render correctly, blocks cannot be hidden.
99+
// Instead, use styles to visually hide blocks.
100+
.block-editor-block-list__block.is-block-hidden {
101+
visibility: hidden;
102+
overflow: hidden;
103+
height: 0;
104+
border: none !important;
105+
padding: 0 !important;
106+
}
107+
108+
&.is-layout-flex:not(.is-vertical) > .is-block-hidden {
109+
width: 0;
110+
height: auto;
111+
align-self: stretch;
112+
white-space: nowrap !important;
113+
}
114+
96115
// Re-enable it on components inside.
97116
[class^="components-"] {
98117
user-select: text;
@@ -187,17 +206,6 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
187206
&[data-clear="true"] {
188207
float: none;
189208
}
190-
191-
// Hidden blocks.
192-
// In order for the block toolbar to render correctly, blocks cannot be hidden.
193-
// Instead, use styles to visually hide blocks.
194-
&.is-block-hidden {
195-
visibility: hidden !important;
196-
height: 0 !important;
197-
overflow: hidden !important;
198-
border: none !important;
199-
padding: 0 !important;
200-
}
201209
}
202210

203211
.is-outline-mode .block-editor-block-list__block:not(.remove-outline) {

0 commit comments

Comments
 (0)