From 3cd4a1725f527846dd263478a5da7da8d42521d7 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Thu, 25 May 2023 11:23:49 +1000 Subject: [PATCH] Fix being able to select text within disabled blocks --- .../src/components/block-list/content.scss | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/block-editor/src/components/block-list/content.scss b/packages/block-editor/src/components/block-list/content.scss index d7436c33812176..16c2d15b22d5e5 100644 --- a/packages/block-editor/src/components/block-list/content.scss +++ b/packages/block-editor/src/components/block-list/content.scss @@ -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 @@ -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 *"); }