- Issue created by @rozzi
- 🇳🇿New Zealand quietone
Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies → . Also mentioned on the version → section of the list of issue fields documentation.
- 🇮🇳India annmarysruthy
I was able to reproduce the issue by following these steps:
- Enabled the "Convert line breaks into HTML" filter for a text format at /admin/config/content/formats.
- Created a node using that text format.
- Entered Test in the body using the "Source" view in CKEditor, ensuring no extra whitespace or newlines were present.
- Saved the node and viewed the output on the frontend.
Even though the saved source remains
Test
, the rendered output includes a line break (
) between "Test" and the tag._filter_autop() function in filter.module is responsible for converting line breaks into
and wrapping text intags. Within this function, there's a $block regex pattern that defines all block-level elements:
$block = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|math|input|p|h[1-6]|fieldset|legend|hr|article|aside|details|figcaption|figure|footer|header|hgroup|menu|nav|section|summary)';
Since is listed as a block-level element,a newline is added before any tag. Later in the processing, this newline gets transformed intoProposed Resolution:
According to HTML specifications, is an inline-level element, not a block-level one. Therefore, it should not be included in the $block list used by _filter_autop().Removing input from the $block list resolves the issue, as the newline is no longer added before the tag, and no
is inserted. - Merge request !11973Issue #3521607: fix Convert line breaks into HTML prepends any <input> with <br> → (Open) created by annmarysruthy