Problem/Motivation
When embedding an image with the media library and the CKEditor5, the "Toggle caption on" and "Override media image alternative text" do not work well together.
When I click the button for the caption first and then the one for the alternative text I get the following error:
Uncaught CKEditorError: e is null
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-e is null
viewToDom https://core.ddev.site/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=40.2.0:5
v https://core.ddev.site/sites/default/files/js/js_2mrOWHSZx9O6jX7tO-KuQgnqayYo53nHym5P-BpEM2k.js?scope=footer&delta=2&language=en&theme=claro&include=eJyNU1FuwjAMvVBov3aATYKvSTsCcoNpLZw4Sxy0cfoltAEB0tSvPr_3bLmObcUr_mgG7g8xB-DO3pgNkz8lYyVi7yU6YLqgsQxR-pFlKI6kv8U0zp6lAFilM16TF7OXA26OpYKpqPkqfki0wgwhPZKQVay4wKhoAujUhIqNQ5_3mRq3hA8FkoJiMkdixdjIOTL2hAdSiW89lZ-Oviitl6as8XTowgSJ0irzpI63fiSPq-zkYFzndAXAO9Po5wHclTrEOn_QZ2VgsafvLIrPyvx-z1x6qRAgKe6iuK_jkexLmSQ5WtyWqO7JzLZXmKOudM0yrvpFW3bmo7a8yq0w8EtDk0S6lB0H_rw-waMa0ckZd_Os6h20Xis2qSSrzTeyxUZFeIDYL1-T033XKu6onFU9pX-ureU-1eowWQj4fnDkzUDjPlDAvoE_eoNwQA:54
ckeditor5-dll.js:5:597480
Nothing will happen for the user but the error will show up in the developer console each time that "Override media image alternative text" gets clicked. When you click "Toggle caption off" and click "Override media image alternative text" you will be able to set the alternative text.
This does not happen when I use the "Update image from computer" button and click the caption and alternative text buttons of that image.
Steps to reproduce
The following modules are needed:
- CKEditor5
- Text Editor
- Field UI
- Media
- Image
- Views
- Media Library
- Install the modules mentioned above.
- Create a new text format that uses the CKEditor5 and add "Drupal Media" button, the "Caption images" filter and "Embed Media" filter to it.
- Create a new content type or add a field of type "Text (formatted, long, with summary)" to an existing content type.
- Create a new media type with the media source "image" or use an exisiting one.
- Click "+ Add media" under "/admin/content/media" and upload an image. (Use the media type just created)
- Click "+ Add content" under "/admin/content". (Use the content type just created)
- Click the "Insert media" button of the Editor and select an image.
- Click button "Toggle caption on".
- Click button "Override media image alternative text".
- Open the developer console. The error will be there.