Skip to content

Commit

Permalink
Fix being able to select text within disabled blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed May 25, 2023
1 parent 23837de commit 3cd4a17
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions packages/block-editor/src/components/block-list/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,6 @@
padding: 0;
}

.block-editor-block-list__block {
pointer-events: initial;

&.is-editing-disabled {
pointer-events: none;
}
}

.block-editor-block-list__layout .block-editor-block-list__block {
// With `position: static`, Safari marks a full-width selection rectangle, including margins.
// With `position: relative`, Safari marks an inline selection rectangle, similar to that of
Expand All @@ -177,12 +169,19 @@
// We choose relative, as that matches the multi-selection, which is limited to the block footprint.
position: relative;

// Re-enable text-selection on editable blocks.
user-select: text;

// Break long strings of text without spaces so they don't overflow the block.
overflow-wrap: break-word;

// Enable pointer events on editable blocks.
pointer-events: auto;
user-select: text;

// But disable when editing is disabled.
&.is-editing-disabled {
pointer-events: none;
user-select: none;
}

.reusable-block-edit-panel * {
z-index: z-index(".block-editor-block-list__block .reusable-block-edit-panel *");
}
Expand Down

0 comments on commit 3cd4a17

Please sign in to comment.