ckeditor can't be set enabled / disabled / readonly by Form API #states

Created on 30 January 2019, over 5 years ago
Updated 30 April 2023, about 1 year ago

Problem/Motivation

On a Standard Installation of Drupal (8.6.x), If you use states-FAPI (by code or "conditional fields" contrib module ) which disabling/enabling a wysiwyg field.

The disabling/enabling action on field works (I.E. : the field label change from grey to black and return), but the Wysiwig iframe (Ckeditor) remais enabled / disabled (original state)

Step to reproduice

- Install Standard Drupal (8.6.x)
- add state on "body" field of "article" node : disabled until title are filled
code exemple :

function my_module_form_alter(&$form, FormStateInterface $form_state, $form_id) {

    $form['body']['#states'] =
    [
      'disabled' => [
        ':input[name="title[0][value]"]' => ['filled' => FALSE],
      ],
    ];
  }

- create a article
=> The body field are disabled (title in grey, wysiwyg disabled)
- fill the title
=> The body field are "enabled" (title in black)
==> But you can't write the body

Thanks

Edit : rewrite Summary

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France DrDam

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany mxh Offenburg

    Is there a core issue around for ckeditor5? Can't find it right now. The problem seems to still exist when setting $element['#disabled'] = TRUE; on an input element that makes use of ckeditor.

Production build 0.69.0 2024