Review main Merged

93509[BUGFIX] Strip block-level tags from RTE checkbox label in ext:form

Josua Vogel CR +2 V +2 Easy +3 −2 updated 04/02/26, 06:00

Commit message

Since v14.2, EXT:form supports rich-text editing for checkbox labels
(e.g. for privacy-policy consent text). The RTE processing pipeline
(`RteHtmlParser::divideIntoLines()`) always wraps content in `<p>`
tags as part of the `css_transform` transformation. When rendered
inside a `<label>` element, these `<p>` tags produce invalid HTML
because `<label>` only allows phrasing content (inline elements).

The `Checkbox.fluid.html` partial is extended to pipe the label value
through `f:format.stripTags` at the end of the rendering chain, after
`f:sanitize.html` and `f:transform.html`. The `allowedTags` argument
is set to exactly the tags permitted by the `form-label` RTE preset
(`<a>`, `<br>`, `<i>`, `<strong>`), ensuring that only valid
phrasing-content elements remain inside `<label>`.

Review

  • Code review CR +2 Done
    • Garvin Hicking +2
    • Sven Liebert +1
  • Verified V +2 Done
    • Garvin Hicking +2
    • Sven Liebert +1
    • core-ci +1 CI

Issues 1

Files 2

Review log 1012

  1. Josua Vogel uploaded patch set 1 04/01/26, 10:23

  2. core-ci voted on patch set 1 V +1 04/01/26, 10:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99388

  3. Garvin Hicking commented on patch set 1 04/01/26, 13:13

    Checkbox.fluid.html:23

    what about `em`? span? cite, sub, sup, code, abbr... I wonder how we could make that manageable by the user, if we need yet another element property for that or YAML config. To make it easy maybe we could list all valid inline attributes here?
  4. Josua Vogel commented on patch set 1 04/01/26, 13:33

    Checkbox.fluid.html:23 Reply

    well, the form-label rte preset ships only those tags. If someone uses a custom rte preset, he should adapt the template accordingly. I think it's really hard to keep track of everything people get up to here :)
  5. Garvin Hicking commented on patch set 1 04/01/26, 15:30

    Checkbox.fluid.html:23 Reply

    I see. How about using it like your approach then and add a note in the RTE label preset to note this dependency on the rendering template? Like: ``` # If you adapt this preset, you need to ship your own Checkbox.fluid.html template alongside it, and adapt the `stripTags` call ```
  6. Josua Vogel uploaded patch set 2 V +1 04/01/26, 16:14

  7. Josua Vogel commented on patch set 2 04/01/26, 16:14

    Checkbox.fluid.html:23 Reply

    Done
  8. core-ci voted on patch set 2 V +1 04/01/26, 16:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/99419

  9. Garvin Hicking commented on patch set 2 CR +1 V +1 04/01/26, 16:49

    Thx!
  10. Sven Liebert voted on patch set 2 CR +1 V +1 04/02/26, 05:32

  11. Garvin Hicking voted on patch set 2 CR +2 V +2 04/02/26, 06:00

  12. Garvin Hicking merged patch set 3 04/02/26, 06:00