Problem/Motivation

The checkbox "Correct faulty and chopped off HTML" doesn't work for me.
Not only in layout builder (screenshots), it's the same effect on every text field with this text format.

Drupal: 9.5.2
CKeditor 5

Additional p tag

Additional p tag

Additional p tag

I'm coming from this issue: #3199643: CKEditor list adds unwanted P tag on restricted HTML

Comments

handkerchief created an issue. See original summary.

handkerchief’s picture

Issue summary: View changes
cilefen’s picture

It isn't the "Convert line breaks..." filter?

Is this specific to CKEditor?

pameeela’s picture

cilefen’s picture

So it is CKEditor and not a Drupal output filter, doing this?

pameeela’s picture

It is the Convert line breaks into HTML (i.e. <br> and <p>) filter

From the other IS:

The problem goes away if the Convert line breaks into HTML (i.e. <br> and <p>) is unchecked but I expect that this isn't the expected behavior since it only affects list where the second list item is indented. I does not happen with the ordered lists.

So should these be moved to filter.module and this one closed as a duplicate?

wim leers’s picture

Title: Unwanted p tags added » Unwanted p tags added when using filter_autop
Status: Active » Fixed

@pameela is correct.

filter_autop should not be used with neither CKEditor 4 nor 5.

CKEditor 5 actually used to explicitly disallow this filter plugin from being enabled. But because so many legacy sites (especially upgraded from Drupal 5, 6 and 7) were using CKEditor 4 in combination with filter_autop, it was decided in #3273312: Upgrading from CKEditor 4 for a text format that has FilterInterface::TYPE_MARKUP_LANGUAGE filters enabled to allow this because no real problems are caused.

What you're reporting here (the unwanted <p>) tags is the remaining problem that is being caused.

Just disable filter_autop (label in the UI: Convert line breaks into HTML (i.e. &lt;br&gt; and &lt;p&gt;) and the problem goes away 👍😊

wim leers’s picture

Category: Bug report » Support request

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

handkerchief’s picture

Thx @Wim Leers for all your support. Unfortunately, disabling the option "Convert line breaks..." does not help, the additional p tags still appear. Even after I have entered the texts afterwards quite fresh. Am I missing something? I have always cleared the cache several times.

I'm on Drupal 10.0.3 now.

handkerchief’s picture

Forget it, now it is solved. An additional template file was also responsible.

vipul tulse’s picture

@handkerchief Can guide us which additional template file you changes/deleted

handkerchief’s picture

@vipul tulse Sure. It was additional a custom field template from my own theme. The custom template has additionally added p tags. So it was a mix. First, it worked with the fixes mentioned in this issue, then in another project, my own template was the reason.