Skip to content

Commit f0640db

Browse files
committed
Improve documentation comments in the code
1 parent 7226f4b commit f0640db

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

packages/block-library/src/cover/save.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ export default function save( { attributes } ) {
143143
/>
144144
) }
145145

146+
{ /* The `wp-block-cover__background` needs to be immediately before
147+
the `wp-block-cover__inner-container`, so the exclusion CSS selector
148+
`.wp-block-cover__background + .wp-block-cover__inner-container`
149+
works properly. If it needs to be changed in the future, the
150+
selector for the backward compatibility for v14 deprecation also
151+
needs change. */ }
146152
<span
147153
aria-hidden="true"
148154
className={ clsx(

packages/block-library/src/cover/style.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
}
9595

9696
.wp-block-cover__inner-container {
97-
position: relative; // Needed after the v14 deprecation..
97+
position: relative; // Needed for the inner container to be positioned above other elements with absolute positioning.
9898
width: 100%;
9999
color: inherit;
100100
// Reset the fixed LTR direction at the root of the block in RTL languages.
@@ -289,13 +289,14 @@ section.wp-block-cover-image > h2,
289289
}
290290

291291
// Backward compatibility for v14 deprecation. Only applied to the frontend.
292+
// Regarding the `.wp-block-cover__background + .wp-block-cover__inner-container`
293+
// selector: When the `.wp-block-cover__inner-container` comes right after the
294+
// `.wp-block-cover__background` , it means that it's using the new HTML
295+
// structure or that it's using the color background or gradient (even in
296+
// the deprecated version). In the color background or gradient option we don't
297+
// need the z-index because the elements are in the expected order.
292298
body:not(.editor-styles-wrapper) .wp-block-cover:not(
293299
.wp-block-cover:has(
294-
/* When the `.wp-block-cover__inner-container` comes right after the
295-
`.wp-block-cover__background` , it means that it's using the new HTML
296-
structure or that it's using the color background or gradient (even in
297-
the deprecated version). In the last option we also don't need the z-index
298-
because the elements are in the expected order. */
299300
.wp-block-cover__background + .wp-block-cover__inner-container
300301
)
301302
) {

0 commit comments

Comments
 (0)