Problem/Motivation

Existing sites with CKEditor 4 can have 'Allowed HTML tags' containing the tags
<ul type> <ol type start>

For example:
CKEditor 4 Allowed HTML tags

When switching to CKEditor 5, these tags will be added to "Manually editable HTML tags":
CKEditor 5 Manually editable HTML tags

Issue #3261599: Use CKEditor 5's native <ol start> support (and also support <ol reversed>) already covers 'start'.
However, 'type' is not yet handled and causes CKEditor 5 to break when empty lists are present, or added, using the Source option.

Steps to reproduce

The easiest way to trigger the same behaviour :

  1. Configure CKEditor 5 with the "Manually editable HTML tags" to include <ul type> <ol type>
  2. Configure CKEditor 5 to include the "Source" button in the toolbar
  3. Find/create a text field on content using the editor and prepare it wil a list with at least one list item.
  4. Switch to "Source" mode and add an empty list (ul, ol) to the field.
  5. Turn off "Source" mode and observe CKEditor throwing an error while nothing visually happens.
  6. Try to turn off "Source" mode again a few times and observe weird visual behaviour

Example:

https://www.drupal.org/files/issues/2022-04-08/ckeditor5.mov

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

andreasderijcke created an issue. See original summary.

wim leers’s picture

Title: Support <ul type>, <ol type> in SourceEditing » [upstream] [GHS] Allowing `<ul type>` or `<ol type>` in SourceEditing crashes CKEditor 5 when editing `<ul></ul>` or `<ol</ol>`
Status: Active » Postponed
Issue tags: +Needs upstream bugfix, +JavaScript

Wonderful find! 🤩

Clarifying the title to make it clear that this only happens on invalid markup: <ol></ol> and <ul></ul>, without <li> children is the only way to crash this.

Upstream issue created based on your information 🙏🥳 https://github.com/ckeditor/ckeditor5/issues/11595

wim leers’s picture

Title: [upstream] [GHS] Allowing `<ul type>` or `<ol type>` in SourceEditing crashes CKEditor 5 when editing `<ul></ul>` or `<ol</ol>` » [upstream] [GHS] Allowing `<ul type>` or `<ol type>` in SourceEditing crashes CKEditor 5 when editing `<ul></ul>` or `<ol></ol>`
Issue tags: +stable blocker
Parent issue: » #3238333: Roadmap to CKEditor 5 stable in Drupal 9
wim leers’s picture

Title: [upstream] [GHS] Allowing `<ul type>` or `<ol type>` in SourceEditing crashes CKEditor 5 when editing `<ul></ul>` or `<ol></ol>` » [upstream] [GHS] Allowing `<ul type>` or `<ol type>` in SourceEditing crashes CKEditor 5 when editing invalid HTML (`<ul></ul>` or `<ol></ol>`)
Version: 9.3.x-dev » 10.0.x-dev
Priority: Normal » Major
Issue tags: -stable blocker
Parent issue: #3238333: Roadmap to CKEditor 5 stable in Drupal 9 »

Actually, this does not make sense to be a stable blocker because A) it does not result in data loss, B) it requires very invalid HTML.

But it does seem Major given that the editor can no longer be used for content containing invalid HTML markup.

lauriii’s picture

I'm not sure if this changes whether this should be a stable blocker or not; but based on WHATWG, <ul> and <ol> elements can contain zero or more li elements. 🤷‍♂️

wim leers’s picture

Wow! 🤪

lauriii’s picture

Title: [upstream] [GHS] Allowing `<ul type>` or `<ol type>` in SourceEditing crashes CKEditor 5 when editing invalid HTML (`<ul></ul>` or `<ol></ol>`) » [upstream] [GHS] Allowing `<ul type>` or `<ol type>` in SourceEditing crashes CKEditor 5 when editing `<ul></ul>` or `<ol></ol>` without any <li> elements as children
wim leers’s picture

Note that even without the specific steps to reproduce reported here, #3274651: Impossible to enable <ol type> or <ul type> with GHS: switch to List's successor, DocumentList means that even when not trying to trigger the crash, the type attribute is lost.

Therefore this is sort of postponed on #3274651: Impossible to enable <ol type> or <ul type> with GHS: switch to List's successor, DocumentList.

wim leers’s picture

wim leers’s picture

Status: Postponed » Closed (outdated)

Just manually tested, and YAY! I can confirm that #3274651: Impossible to enable <ol type> or <ul type> with GHS: switch to List's successor, DocumentList indeed fixes this! 🥳

Transferring tags + credit to that issue 👍