Skip to content

Commit

Permalink
Rich text: remove is-selected class (#19822)
Browse files Browse the repository at this point in the history
* Rich text: prefix is-selected class

* Adjust more cases

* Remove the class
  • Loading branch information
ellatrix committed Jan 23, 2020
1 parent 0de9e37 commit 4ae2c15
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
1 change: 0 additions & 1 deletion packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
23 changes: 11 additions & 12 deletions packages/block-editor/src/components/rich-text/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
}
}

Expand Down
4 changes: 0 additions & 4 deletions packages/block-library/src/navigation-link/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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"] {
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/specs/editor/blocks/navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4ae2c15

Please sign in to comment.