-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Improve scoping of nested paragraph right-padding rule #12106
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
Conversation
This addresses feedback in #11757 (comment). The initial issue was that in the default appender, and in empty paragraphs, the plus to add blocks overlaps the placeholder text. The right-padding fixed that. But it bled into other blocks with placeholders, such as the Button block. This PR scopes the rich text rule to only apply to empty paragraphs. The appender was already scoped.
| // On mobile and in nested contexts, the plus to add blocks shows up on the right. | ||
| // This padding makes sure it doesn't overlap text. | ||
| & + .editor-rich-text__tinymce { | ||
| & + .editor-rich-text__tinymce.wp-block-paragraph { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that we target specific blocks in a generic component, what's the reason here? We could do the opposite if needed. Target the richText in the block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Target the richText in the block.
Do you mean move these styles into the paragraph block?
Given we have a unique case for the empty paragraph block, I think it's okay to make rules specific to that. But you could have a point in where the styles should live.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, move to paragraph what's specific to paragraph and leave here what's generic to RichText.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good thoughts. Fixed it in 0879d8a:
| // Specific to the empty paragraph placeholder: | ||
| // when shown on mobile and in nested contexts, the plus to add blocks shows up on the right. | ||
| // This padding makes sure it doesn't overlap text. | ||
| .editor-rich-text__tinymce[data-is-placeholder-visible="true"] + .editor-rich-text__tinymce.wp-block-paragraph { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be in editor.scss right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argh, yes it should. Many apologies, I know you're busy. 81a81a4 should fix that up.
|
@youknowriad looks like your comments have been addressed -- can we get this merged? |
youknowriad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍

This addresses feedback in #11757 (comment).
The initial issue was that in the default appender, and in empty paragraphs, the plus to add blocks overlaps the placeholder text. The right-padding fixed that. But it bled into other blocks with placeholders, such as the Button block.
This PR scopes the rich text rule to only apply to empty paragraphs. The appender was already scoped.
Before:
After:
The button isn't as wide on the right side, in the after.