Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rich text: remove is-selected class #19822

Merged
merged 3 commits into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
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;
Copy link
Member Author

Choose a reason for hiding this comment

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

Tested and now the placeholder looks good when the item is selected but not focussed:

Screenshot 2020-01-23 at 11 04 14

Copy link
Contributor

Choose a reason for hiding this comment

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

An issue seems to be still there. If you focus the label, it doesn't show the caret, making the behavior weird to understand.

image

Copy link
Contributor

Choose a reason for hiding this comment

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

just in case fixed #20075 (feel free to review it)

}
}

[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