diff --git a/packages/block-editor/src/components/rich-text/index.js b/packages/block-editor/src/components/rich-text/index.js index 78ac7b4dfa4b2..cae2f37ce7139 100644 --- a/packages/block-editor/src/components/rich-text/index.js +++ b/packages/block-editor/src/components/rich-text/index.js @@ -386,7 +386,6 @@ class RichTextWrapper extends Component { onSelectionChange={ onSelectionChange } tagName={ tagName } className={ classnames( classes, className, { - 'is-selected': originalIsSelected, 'keep-placeholder-on-focus': keepPlaceholderOnFocus, } ) } placeholder={ placeholder } diff --git a/packages/block-editor/src/components/rich-text/style.scss b/packages/block-editor/src/components/rich-text/style.scss index 5d0971d4847c0..bfcf0c0e02e24 100644 --- a/packages/block-editor/src/components/rich-text/style.scss +++ b/packages/block-editor/src/components/rich-text/style.scss @@ -16,15 +16,6 @@ font-size: inherit; // This is necessary to override upstream CSS. } - &:focus { - // Removes outline added by the browser. - outline: none; - - *[data-rich-text-format-boundary] { - border-radius: 2px; - } - } - [data-rich-text-placeholder] { pointer-events: none; } @@ -36,9 +27,17 @@ opacity: 0.62; } - // Could be unset for individual rich text instances. - &.is-selected:not(.keep-placeholder-on-focus) [data-rich-text-placeholder]::after { - display: none; + &:focus { + // Removes outline added by the browser. + outline: none; + + [data-rich-text-format-boundary] { + border-radius: 2px; + } + + &:not(.keep-placeholder-on-focus) [data-rich-text-placeholder]::after { + display: none; + } } } diff --git a/packages/block-library/src/navigation-link/editor.scss b/packages/block-library/src/navigation-link/editor.scss index a61d103abac4a..13d7ce777e36f 100644 --- a/packages/block-library/src/navigation-link/editor.scss +++ b/packages/block-library/src/navigation-link/editor.scss @@ -50,10 +50,6 @@ .wp-block-navigation-link__submenu-icon { margin-left: 4px; } - - .block-editor-rich-text__editable.is-selected:not(.keep-placeholder-on-focus):not(:focus) [data-rich-text-placeholder]::after { - display: inline-block; - } } [data-type="core/navigation-link"] { diff --git a/packages/e2e-tests/specs/editor/blocks/navigation.test.js b/packages/e2e-tests/specs/editor/blocks/navigation.test.js index 37e9db2c27611..bdb237c0aee04 100644 --- a/packages/e2e-tests/specs/editor/blocks/navigation.test.js +++ b/packages/e2e-tests/specs/editor/blocks/navigation.test.js @@ -59,7 +59,7 @@ async function updateActiveNavigationLink( { url, label } ) { } if ( label ) { - await page.click( '.wp-block-navigation-link__label.is-selected' ); + await page.click( '.is-selected .wp-block-navigation-link__label' ); // Ideally this would be `await pressKeyWithModifier( 'primary', 'a' )` // to select all text like other tests do.