Issue Task Needs Feedback Quiet

#109002Remove ckeditor data-list-item-id attribute from list item elements by default

Patrick Lenk 02/18/26, 10:12 updated 10/26/26, 11:04

Description

Since TYPO3 v13 LTS and CKEditor 45.1.1 list items (

  • elements) in the editor data output contain an additional attribute data-list-item-id. The attribute seems necessary to ensure that the lists feature work correctly with other editor features and mechanisms.
  • It would be great if this attribute can be excluded from frontend rendering by default.

    See docs: https://ckeditor.com/docs/ckeditor5/latest/features/lists/lists.html#editor-output-configuration
    See discussion: https://github.com/ckeditor/ckeditor5/issues/19006

    Reviews 0

    No change resolves or names this issue in its commit message, and no comment links one.

    Fix this issue

    Start the commit message of your patch with this. Add what the patch does, and the versions it goes to in "Releases:". How to create a patch

    Commit message
    [TASK] Remove ckeditor data-list-item-id attribute from list item elements by default Resolves: #109002 Releases: main

    History 6

    1. Garvin Hicking commented and changed status New Needs Feedback priority Should have Could have <span data-processor="relativetime" data-value="2026-02-18T19:41:16+00:00" > 02/18/26, 19:41 </span>

      Probably this could be done with e RTE processing directive or a parseFunc_RTE directive.

      We try to not “enlarge” our default for this though.

      You could also apply a middleware to remove it,
      or utilize the psr events for the db persistence.

      Doing that by default could accidentally scrub these generic data attributes though that people MIGHT use now that they are introduced.

      So my question is….: Why is the atttribute problematic in frontend output? It’s valid HTML and validates, so for now I would argue it’s a cosmetic nuissance?

    2. Alexander Rotzsch commented <span data-processor="relativetime" data-value="2026-03-03T14:13:04+00:00" > 03/03/26, 14:13 </span>

      These additional attributes break our implementation in EXT:pdfviewhelpers, where we forced text to array conversation to get an unordered list. The PDF is messed up with HTML code now.

      This is our code that worked before:

      <f:variable name="someVariable"><f:split separator="</li><li>"><f:replace value="{newsItem.someField -> f:spaceless()}" search="{0: '<ul><li>', 1: '</li></ul>', 2: '<p>', 3: '</p>', 4: '<strong>', 5: '</strong>', 6: '<sup>', 7: '</sup>'}" replace="{0: '', 1: '', 2: '', 3: '', 4: '', 5: '', 6: '', 7: ''}" /></f:split></f:variable>

      Workaround I found using EXT:vhs:

      <f:variable name="regexPattern" value="/(?i)<li[^>]*>/"/>
      <f:variable name="regexReplacement" value="<li>"/>
      {newsItem.someField -> f:spaceless() -> v:format.pregReplace(pattern: '{regexPattern}', replacement: '{regexReplacement}')}

      An option where you can strip these attributes in the CKEditor config would be appreciated.

    3. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-03-03T20:27:23+00:00" > 03/03/26, 20:27 </span>

      I think your old logic also has many other edge cases: newlines, css classes etc. So you would definitely haveto adjust your scrubbing already, independent from this specific issue.

      I think you can use RTE Processing with a YAML config applied to RTEParseFunc to remove also foyed data attributes.

      Also you can use the PSR-14 Events for the RTE transformations to do the replacement.

      I don’t think we can specifically add replacements for this to the Core to not create maintenance hell and affect possible usage of this. The data attribute is quite HTML5 valid so I don’t really see an immediate need to do cleanup for CKEditor in the TYPO3 Core I’m afraid.

    4. Patrick Lenk commented <span data-processor="relativetime" data-value="2026-10-13T08:26:43+00:00" > 10/13/26, 08:26 </span>

      Garvin Hicking wrote in #note-3:
      > I think your old logic also has many other edge cases: newlines, css classes etc. So you would definitely haveto adjust your scrubbing already, independent from this specific issue.
      >
      > I think you can use RTE Processing with a YAML config applied to RTEParseFunc to remove also foyed data attributes.
      >
      > Also you can use the PSR-14 Events for the RTE transformations to do the replacement.
      >
      > I don’t think we can specifically add replacements for this to the Core to not create maintenance hell and affect possible usage of this. The data attribute is quite HTML5 valid so I don’t really see an immediate need to do cleanup for CKEditor in the TYPO3 Core I’m afraid.

      Thanks, then it can be closed.

    5. Garvin Hicking commented <span data-processor="relativetime" data-value="2026-10-13T10:18:38+00:00" > 10/13/26, 10:18 </span>

      I’m leaving it open for a bit longer, as it came up in the core team again. We don’t really like it, but I also am a bit unclear how to improve it :(

    6. Markus Timtner commented <span data-processor="relativetime" data-value="2026-10-26T11:04:50+00:00" > 10/26/26, 11:04 </span>

      since I don’t like it all, too, I investigated further into this:

      Nothing in the TYPO3 PHP calculates it. data-list-item-id comes from CKEditor 5’s list feature — the RTE in the backend browser generates it and TYPO3 saves the editor’s data verbatim, so it lands in the database and later in the frontend output.

      Upstream CKEditor added it in 45.1.1 (“Starting with version 45.1.1, list items in the editor data output contain an additional attribute data-list-item-id”). TYPO3 pulled that in with 35c79e8f67a [TASK] Update to CKEditor 5 46.1.1 (2025‑07‑09) — the oldest commit whose ckeditor5-list.js contains the string. All maintained branches ship it today (main, 13.4, 14.3 are on ckeditor5 ^48.5.2), so it is not a v15 novelty.

      It seems that nothing in the editor config can switch the attribute off; it has to be scrubbed out of the HTML on save^^

      temp fix is via page tsconfig:

      RTE.default.proc.HTMLparser_db.tags.li.allowedAttribs = class

      or via own preset yaml

      imports:
        - { resource: 'EXT:rte_ckeditor/Configuration/RTE/Default.yaml' }
      
      processing:
        HTMLparser_db:
          tags:
            li:
              allowedAttribs: 'class'

      will have a look into this further.