Column header settings in tables are lost when reopening content in the WYSIWYG editor (CKEditor)

Created on 28 January 2025, 25 days ago

Problem/Motivation

When creating or editing a table using the WYSIWYG editor (CKEditor), column header settings are correctly applied upon saving. However, if rows in the table are merged (using rowspan) while setting column headers, the column header designation is lost when the content is reopened in the editor. Interestingly, merging columns (colspan) with row headers does not cause this issue. This inconsistency forces users to reapply column header settings whenever rows are merged, leading to a poor editing experience.

Steps to reproduce

  1. Enable a WYSIWYG editor (e.g., CKEditor) for a content type.
  2. Go to the content creation or editing page.
  3. Create a table using the editor.
  4. Merge rows (use rowspan) and set column headers.
  5. Save the content.
  6. Reopen the content in the editor and observe that the column header settings are no longer applied.
  7. Note: This issue does not occur if columns are merged (colspan) with row headers.

Proposed resolution

Investigate why merging rows while setting column headers causes the header settings to be lost, and implement a fix. Focus areas include:

  • CKEditor configuration to ensure that header-related attributes are preserved during the save and reload process, especially when rows are merged.
  • Input filter settings to verify that the header attributes are not being stripped out.

Remaining tasks

  • Test the issue in a clean Drupal installation to confirm the behavior.
  • Determine if the problem is specific to CKEditor or Drupal core.
  • Develop and test a fix to ensure column header settings are preserved, even when rows are merged.
  • Submit a patch or update documentation as needed.

User interface changes

No visible user interface changes are anticipated. The fix will ensure consistent behavior for table header settings in the editor.

Introduced terminology

No new terminology introduced.

API changes

No API changes expected.

Data model changes

No data model changes expected.

Release notes snippet

Fixed an issue where column header settings in tables were not retained when reopening content in the WYSIWYG editor, particularly when rows were merged.

🐛 Bug report
Status

Active

Version

10.3

Component

editor.module

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @kohei_iwamura
  • 🇳🇿New Zealand quietone

    Drupal 10.3 is only eligible for security fixes. Also, 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 .

  • I have replicated the issue where column header settings are lost when merging rows using rowspan in CKEditor 5, but it doesn't occur when merging columns with colspan. It seems that CKEditor is not correctly preserving the rowspan and colspan attributes when rows are merged. Additionally, input filter settings may be stripping out these attributes during the save process.
    To resolve this, we could adjust the CKEditor configuration to ensure the rowspan and colspan attributes are handled properly during both the save and reload processes.
    As image attached, in below table Merge cells and then enable column header. After save when try to enable header column for other cell. It also enable previously removed header column.

Production build 0.71.5 2024