Repository navigation
Conversation
Add block support for text indent to the content and excerpt blocks, including typography selectors.
This comment was marked as outdated.
This comment was marked as outdated.
|
Flaky tests detected in cb53932. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25787145217
|
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Thanks for the ping @carolinan. With images, I can think much clearer 😀 The example just illustrates my latest comment on the #76952 discussion. The feature should be removed from Users would have much more control if the feature were allowed in limited contexts, such as |
|
The excerpt block is just one paragraph, but the content can contain almost anything. So should the indent on the content be applied to any text block? |
juanfra
left a comment
There was a problem hiding this comment.
Thanks for working on this! I tested it locally and ran into some things. This is the first time I use this feature so that could be the reason. I have some questions/comments.
-
As we rely on the block paragraph classes (I'm stoked to finally see w have the CSS class in the paragraph block 😄), setting "Indent all paragraphs" on core/paragraph adds a
.wp-block-paragraph { text-indent: ... }that bleeds into the other two (post-contentandpost-excerpt) regardless of their own settings. I think, for clarity, we need to explicitly decide which setting wins and enforce it in the selector logic. I think in the end there can be combinations that will bleed into each other or depend on which one is printing the CSS last, and we need to account for this (or document it). -
The
>direct-child selector is assuming that paragraphs are direct children of the post content wrapper. In many cases that will be true, but some templates may nest the content in groups/columns/etc. For those cases, I believe the feature will look broken.
Side notes, and unrelated to these changes:
A. The help text under "Indent all paragraphs" changes based on the toggle's own state, which makes things really confusing. Help texts should not change on action, they should be permanent. I think the controls for this feature could be more intuitive.
B. On a similar note, the + selector seems to be following the editorial convention of not indenting a paragraph that opens a new section (after a heading, image, etc.) and then indenting the rest. My first impression, after adding a value to "line indent" was that the feature wasn't working correctly, because it was indenting some paragraphs but not others. Again, I wasn't familiar with this. I think it can happen to others. We can maybe improve the way this is communicated so that people can understand that it is working as designed, and it's not a bug. I also think what I described in point A is not helping with this.
|
@juanfra |
|
@carolinan sorry if I wasn't clear. I'm not saying a default should override a setting the user turned on. If indent is enabled globally, it should affect paragraphs everywhere, including post content. Agreed. My point is what happens when the two settings differ. Paragraphs inside post content are also
Both hit the same paragraphs, and which wins comes down to CSS specificity, not an actual decision. It's also that if the values are different, with the Excerpt is a different story because, from what I understand, is always one paragraph. What I don't understand then is why the indent works different between excerpt and paragraph/post-content. For the latter, by default, it's indenting all paragraphs but the first. For excerpt it indents the first (and only). A and B were just notes after experimenting with this feature and trying to understand. Probably discussions to have somewhere else. |
|
The settings will only differ when one of them is the default and the other is enabled so I still didn't understand. The excerpt block uses two paraphs when the "continue reading" / read more text is added by the user. |
|
Thanks Carolina!
I believe there are other scenarios. Could be that one has 65px and the other one 45px. Could be that one has the "Indent all" and the other not.
True. What I meant is that for the excerpt there's only one paragraph with "content". Unless I am missing something, I believe by default: For the other two blocks, the indent is applied not to the first paragraph of a section, but the others ( indent-works-on-subsequent-paragraphs-by-default.mp4 |
|
I don't understand. The screencast is of a single paragraph in a post content block, and the setting that is changed is on the single paragraph. It has nothing to do with sections, since it is the single individual block that the setting is being changed on. I am not saying "no", I am saying I don't understand. I don't think I can continue working on it if I can't understand what the settings are expected to do. That is also why I kept asking all those questions earlier (also on Slack). |
|
Are you expecting the words "This is the first..." to be indented when "all paragraphs" is toggled on? |
|
Thanks for the follow-up @carolinan. I'm new to this feature as well. What I am trying to show with the screencast: The indent setting for the paragraph block has an effect from the 2nd paragraph onwards. With that screencast, I expose the inconsistency that I am referring to. The behavior of the same setting will be different on the excerpt block (where it indents the first and only paragraph) vs. paragraph/post-content (where it indents from the second paragraph onwards). To summarize everything I shared in my messages:
I hope this helps clarify. I'm sorry the screencast confused you. |
|
I don't know how to solve the merge conflict nor update the branch with the changes from trunk after the documentation changes, there are too many errors. |
|
Hi @carolinan 👋 About the conflict with This PR was opened before #77612 was merged (Jun 7), which restructured the generated block docs: Resolution (tested locally, clean):
The Please, let me know if you're having more issues. |
# Conflicts: # docs/reference-guides/core-blocks.md
|
@juanmaguitar Thank you. @juanfra Because the settings is part of the typography panel, I have not found a way to address the Indent all paragraphs option on the excerpt block without adding an explicit check for that specific block, and then not print the control. |
|
I'm more and more uncertain that we should implement this. |
|
I feel the same about it, @carolinan. I can’t think of a case in which |
|
Hi @carolinan, @juanmaguitar, and @juanfra, I finally understand what is going on with this one. The option Indent All isn’t suitable for However, when discussing the
|
|
But that is the opposite of how the setting works now for the paragraph block. (Which is very awkward because when it is on, it also indents the likes of "Sorry there are no search results") |
|
Yes, @carolinan, you’re right. Applying this to the Paragraph block causes many issues, including the one you reported (“Sorry, there are no search results”). For this reason, my first requirement was to remove the feature entirely from the Paragraph block and later have it fixed and applied to limited-use blocks, such as Excerpt and Content blocks. |
|
The problem is that is is not experimental: how do we remove something from the editor that users are already using? With as little impact as possible? Who makes the decision? |
|
I really don’t know about that. Internally, I am constantly asked to help improve the product and make the Editor better for everyone. That is my argument for suggesting fixes, especially ones like this that can indent oddly when paragraph lines are active on a site. I thought this was something we could and should fix. If not, that’s fine; I can take a step back. But then I may start to question all the work done here on GitHub to fix and evolve the product. I am not sure whether there is ever one person making the final call... |
|
I am not arguing or asking anyone to step back. |
|
No worries, I got you. I was just honest, as I don't know how to proceed after your question of who makes the call to change something that's already in use. 😅 |
|
Although I believe few people would use it, given the issues it causes on the site. |



What?
Closes #76536
Add block support for text indent to the content block.
Note that the PR previously added support to the excerpt block. This has been removed.
In block.json, the text indent is added to a selector that targets the first paragraph inside the block.
Testing Instructions
Note that there are a few blocks that may look like they could be paragraphs, but are not indented, such as the login/out block. This block only uses the
<a>tag.