Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix wp-block class and z-index
  • Loading branch information
youknowriad committed Feb 11, 2022
commit 2fbef4d1e430d5e3a4c3ae366befdc94d2a73279
9 changes: 6 additions & 3 deletions packages/block-editor/src/components/block-list/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ function BlockListBlock( {
);
}

const isAligned = wrapperProps && !! wrapperProps[ 'data-align' ];
const isAligned =
wrapperProps &&
!! wrapperProps[ 'data-align' ] &&
! themeSupportsLayout;

// For aligned blocks, provide a wrapper element so the block can be
// positioned relative to the block column.
Expand All @@ -138,7 +141,7 @@ function BlockListBlock( {
// Due to the differences between frontend and backend, we migrated
// to the layout feature, and we're now aligning the markup of frontend
// and backend.
if ( isAligned && ! themeSupportsLayout ) {
if ( isAligned ) {
blockEdit = (
<div
className="wp-block"
Expand Down Expand Up @@ -180,7 +183,7 @@ function BlockListBlock( {
const value = {
clientId,
className:
isAligned && themeSupportsLayout
wrapperProps[ 'data-align' ] && themeSupportsLayout
? classnames(
className,
`align${ wrapperProps[ 'data-align' ] }`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to add this as a class instead of sticking to the data attributes or inline layout styles?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline layout styles target these classes. This matches the markup in the frontend.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@
}

.wp-block[data-align="left"] > *,
.wp-block[data-align="right"] > * {
.wp-block[data-align="right"] > *,
.wp-block.alignleft,
.wp-block.alignright {
// Without z-index, won't be clickable as "above" adjacent content.
z-index: z-index("{core/image aligned left or right} .wp-block");
}
Expand Down