Problem/Motivation

While the D9->D10 update will be smooth and transparent, switching from CKEditor (4) to CKEditor 5 in Drupal 9 results in a very informative but slightly overwhelming set of messages.

Steps to reproduce

Install Standard profile
Install and enable CKEditor 5 module
Go to Configuration -> Content Authoring -> Text formats and editors
Configure the Basic HTML format
Switch the "Text editor" select list from CKEditor to CKEditor 5

Proposed resolution

TBD
One suggestion was to link to the /admin/help/ckeditor5 page, especially to help explain CKE plugins.

The current messages

In CKEditor 5, configuring “Allowed HTML Tags” is no longer an independent config step. The allowed tags directly correspond to which CKEditor 5 plugins are enabled and how those plugins are configured.

When switching a text format to CKEditor 5, the format’s configuration is analyzed and plugins+config are automatically configured to settings that ensure zero data loss. There are several scenarios covered by this process.

No messages are displayed for 1:1 mappings of CKEditor 4 toolbar buttons to CKEditor 5 toolbar items. Because for these, there is nothing to point out to the user: if it looks and functions the same, there’s no need to inform the user.

If

or
are not allowed in the original format

These tags are automatically added since they are essential to CKEditor 5 functioning.

The following tag(s) were added to Limit allowed HTML tags and correct faulty HTML, because they are needed to provide fundamental CKEditor 5 functionality : @missing_tags.

When CKEditor 5 plugins are enabled in order to support tags supported in original format.

If available, CKEditor 5 plugins that support these tags/attributes are automatically enabled. For example if <table> is supported, the CKEditor 5 table plugin is automatically enabled. This is a general message stating the plugins that were enabled. It is accompanied by additional messages detailing the specific reason a plugin was enabled.

The following plugins were enabled to support tags that are allowed by this text format: %enabling_message_content.

Tags supported from original format not supported by available CKEditor 5 plugins

If an allowed tag is not supported by any CKEditor 5 available plugin, the “Source Editing” plugin is added and the tag/attribute is added to its list of “Manually editable HTML tags”

The following tags were permitted by this format's filter configuration, but no plugin was available that supports them. To ensure the tags remain supported by this text format, the following were added to the Source Editing plugin's Manually editable HTML tags: @unsupported_string.

When CKEditor 5 plugins are enabled in order to specifically support attributes (not tags) supported in original format.

The following plugins were enabled to support specific attributes that are allowed by this text format: %enabled_for_attributes_message_content.

Attributes supported by original text format not supported by available CKEditor 5 plugins

If an allowed attribute is not supported by any CKEditor 5 available plugin, the “Source Editing” plugin is added and the attribute (with the tags it is associated with) is added to its list of “Manually editable HTML tags”

This format's HTML filters includes plugins that support the following tags, but not some of their attributes. To ensure these attributes remain supported by this text format, the following were added to the Source Editing plugin's Manually editable HTML tags: @missing_attributes.

Remaining tasks

TBD

User interface changes

The warning message about missing Claro and Olivero styles will be addressed by #3285054: Add ckeditor5-stylesheets: false to Claro and Olivero (and fix it 😅).

API changes

N/A

Data model changes

N/A

Issue fork drupal-3245967

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tim.plunkett created an issue. See original summary.

wim leers’s picture

Project: CKEditor 5 » Drupal core
Version: 1.0.x-dev » 9.3.x-dev
Component: User interface » ckeditor5.module
Issue tags: +Usability
wim leers’s picture

Title: Messages upon switching to CKEditor 5 in D9 are overwhelming » Messages upon switching to CKEditor 5 are overwhelming

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

wim leers’s picture

#3273325: CKE5 and contrib: better "next action" description on upgrade path messages landed and has made a big improvement to the usability/scannability/interpretability of these messages 🥳

bnjmnm’s picture

Issue summary: View changes
bnjmnm’s picture

I brought this issue to last weeks UX meeting #3275459: Drupal Usability Meeting 2022-04-22. There is a recording with the full discussion, and I'll summarize what I believe to be the key takeaways.

  • Several attendees +1'd the notion that the messaging is too much. Nobody -1'd that notion.
  • Several in attendance had worked with CKEditor 5 and seen these messages before. Most (perhaps all) did not fully understand what these messages meant until I provided a several-minute explanation as part of introducing the issue.
  • It was suggested that in most cases, the switch to CKEditor 5 does not change overall functionality or restrictions. Typically, the only difference is that allowing/disallowing a given tag happens in a different place on the text format form. It may not be necessary to have anything beyond a brief message in these use cases. noteThere's one possible scenario where a CK5 plugin is enabled to support a tag/attribute, and that enabling adds support for additional tags/attributes not supported pre-CK5. In such a scenario, it was suggested that the message should be more visible.
  • Several discussion points led to a similar suggestion: If there are any plugins or GHS tags/attributes added, there should be an opening paragraph to contextualize what has happened, followed by a (possibly bulleted) list of shorter items stating what plugins/ghs settings were updated. (i.e. begin it with a TLDR).
  • Benji suggested making the message(s) more concise by "separating the what from the why". The status messages would be a briefer "what", and could link to the CKEditor 5 help page for additional details. This would give users the option of learning more if they believe it to be important, but the overall messaging size is reduce, making it more likely to be read fully. Having the info be in the module help page mitigates the risk of referencing an external URL that could potentially change.
  • The purpose of adding tags to source editing was not clear, and there was some uncertainty about what field/settings was being references. It was also suggested that having source editing as the active tab if it's been changed could make it easier to make the connection.
  • It was suggested the longer versions of the messaging could be written to logs.

bnjmnm credited Antoniya.

bnjmnm credited andregp.

bnjmnm credited cedewey.

bnjmnm credited rkoller.

bnjmnm credited shaal.

bnjmnm’s picture

Adding UX meeting credits

bnjmnm’s picture

wim leers’s picture

It was suggested the longer versions of the messaging could be written to logs.

+1 → this is what the plan has been all along for the actual upgrade path (a hook_update_N() or post-update.php implementation) that will get executed during the 9.y.x10.0.x update: because there is no UI to show these messages anyway.

The purpose of adding tags to source editing was not clear, and there was some uncertainty about what field/settings was being references. It was also suggested that having source editing as the active tab if it's been changed could make it easier to make the connection.

Interesting suggestion! Seems feasible. Just checking: would this be a problem for accessibility?

It may not be necessary to have anything beyond a brief message in these use cases.

Right — that'd be ideal. The devil will be in the details.

Curious to see what the actual implementation will do here! 🤓 It feels like you have a good grasp on what needs to happen, and perhaps have a vision you want to realize, @bnjmnm?

bnjmnm’s picture

I received great feedback at the UX meeting, and wanted to come up with a solution that integrated as much of it as possible.

The current (longer) messages will be written to logs
This information could still be valuable so a subset of users, but those users will not likely mind going to logs to learn more.

Leverage the help page at admin/help/ckeditor5 to provide additional details for those who want them
The messages will be informative enough that a user can determine if they want a more thorough explanation, and those explanations will be on the help page that comes with the module, and linked via the status/warning message.

One consolidated status message
Something along the lines of...

To maintain the capabilities of this text format, [Smart default settings](HELP:smart default settings) enabled the following plugins: <plugin list> and added the following to the Source Editing Plugin's [Manually editable HTML tags](HELP: how source editing is used in smart default settings ) setting: <tags list>. Additional details are available in your logs.

The linked "help:" sections are ones that would be created as part of this issue

One consolidated warning message

Updating to CKEditor 5 resulted in this text format supporting some tags/attributes that were previously unsupported: {IF <p>||<br>} <p><br> because [they are required by CKEditor 5](HELP: why they are required) {END IF}. {IF tags/attributes added} At least one of the Plugins enabled supports tags/attributes that were not previously supported: These tags: <tags list> and these attributes <attribute: (<impacted tags>)>. {END IF} Please visit [the help page](HELP: surplus tags/attributes) for more information.

The linked "help:" sections are ones that would be created as part of this issue

Not sure if that's the most intuitive way to represent links to theoretical paths or conditional text but that's my attempt 🙂

wim leers’s picture

I really like your proposal! 🤩 Let's implement it? 😄

hooroomoo’s picture

I think it could be helpful too if the logs were linked to the "Additional details are available in your logs" so they can be easily accessed/makes that option more visible

catch’s picture

I think it could be helpful too if the logs were linked to the "Additional details are available in your logs" so they can be easily accessed/makes that option more visible

We've done this with a if (...moduleExists('dblog')) before, if someone's using a different logger they're on their own, but works for enough people and avoids linking to nothing.

bnjmnm’s picture

Status: Active » Needs review
wim leers’s picture

StatusFileSize
new97.17 KB

Phenomenal difference:

👏

Posted a review on the merge request, but keeping this marked as needing review to invite others to review as well :)

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

nod_’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new31.22 KB

+1 to the new messages. Should the warning be above the status message? As-is they are closer to the actionable area so I can see why it's below, hopefully people don't stop at the green message :)

I do have one significant issue with the current patch: using formatPlural to do conditional display of links is a bit too clever I'm afraid (I can still hear the screams of translators I used to work with :).

What happens when the plural formula for the language is not "singular/plural" such as arabic which ones should be translated in that case?

I think we should have properly separated strings for that, the different string versions don't convey the fact that it's singular/plural, it's about another condition, not cardinality. It will trip up translators.

bnjmnm’s picture

Status: Needs work » Needs review

Good call on #27 that was a use of formatPlural I hadn't considered.

nod_’s picture

Issue summary: View changes
Status: Needs review » Needs work

I've noticed the watchdog messages are written to the log before the text format is saved. As soon as we select the cke5 element from the select in the text format config, the messages are written, even if we don't save the text format form. If the user is on the page, select the CKE5 option see the message about the logs, gets curious and click on the link to see the logs he'll be moved away from the configuration page and will essentially lose theirs config (if we assume back button won't work in all cases). They'll go back to the config page, reselect CKE5, see new messages and new log entries will be written so if he looks at the log at that moment they'll have: No CKE5 editor configured, 2 sets of log messages about changing CKE configuration. Not sure what do do about that, probably not too big a deal since it's a pretty low-traffic area anyway.

If we have a bunch of formats it would be helpful to replace "This format's HTML filters" in the log messages by the actual format name because this is ambiguous when seen out of context.

bnjmnm’s picture

Status: Needs work » Needs review

Discussed this with @Wim Leers, MR implements what we decided + a hefty reroll.

xjm’s picture

@bnjmnm suggested that we should consider addressing minor issues in followups given the difficulty of keeping this rerolled/updated, and I agree. So things like code comments, minor API cleanups, and iteration on the phrasings of the UI messages can happen in followup issues, and we'll decide which of those issues are stable-blocking on a case-by-case basis. Thanks!

wim leers’s picture

👍

nod_’s picture

Status: Needs review » Reviewed & tested by the community

single minor comment on an and string that isn't translatable (and we can probably replace by ",") other than that, good for me :)

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

I think the untraslatable "and" is something that warrants moving this to needs work. Maybe it could be replaced by a comma like proposed by @nod_.

catch’s picture

Comma seems fine to me given this is concatenation within a placeholder, pretty sure we do similar elsewhere.

bnjmnm’s picture

Status: Needs work » Needs review

Switching to NR - the three remaining threads in the MR are all about the same thing. I have some additional info that may help us get to a solution?

xjm’s picture

Issue tags: +Drupal 10 beta blocker
bnjmnm’s picture

StatusFileSize
new83.75 KB
new83.75 KB
nod_’s picture

Status: Needs review » Reviewed & tested by the community

FormattableMarkup is better, nice one lauriii :)

This works for me :)

lauriii’s picture

Issue summary: View changes
StatusFileSize
new99.35 KB
spokje’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs reroll

Looks like 3245967-38-95x_100x_101x.patch needs a reroll

bnjmnm’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new83.75 KB
new83.22 KB

rerolls

lauriii’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: -Needs reroll
+++ b/core/modules/ckeditor5/src/SmartDefaultSettings.php
@@ -122,51 +161,64 @@ public function computeSmartDefaultSettings(?EditorInterface $text_editor, Filte
+        $this->logger->info($this->t('The CKEditor 5 migration enabled the following plugins to support tags that are allowed by the %text_format text format: %enabling_message_content. The text format must be saved to make these changes active.',

I realized that we should also use the formattable markup for the logger messages since we don't usually want to make the logger messages translatable.

bnjmnm’s picture

StatusFileSize
new83.15 KB
new83.61 KB
new7.04 KB

Addresses #43 + needed rerolling anyway.

nod_’s picture

Status: Needs review » Reviewed & tested by the community

👍

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/ckeditor5/src/SmartDefaultSettings.php
@@ -249,9 +433,11 @@ private function createSettingsFromCKEditor4(array $ckeditor4_settings, HTMLRest
+            $warning = new FormattableMarkup('The CKEditor 4 button %button does not have a known upgrade path. If it allowed editing markup, then you can do so now through the Source Editing functionality.', [
...
+            $messages[MessengerInterface::TYPE_WARNING][] = $warning;

@@ -287,9 +473,11 @@ private function createSettingsFromCKEditor4(array $ckeditor4_settings, HTMLRest
+        $warning = new FormattableMarkup('The %cke4_plugin_id plugin settings do not have a known upgrade path.', [
...
+        $messages[MessengerInterface::TYPE_WARNING][] = $warning;

These two messages are printed as UI messages so they should be translated. 😅

bnjmnm’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new83.43 KB
new82.97 KB
new2.37 KB

Since it's a small interdiff, I got a +1 from @lauriii to switch back to RTBC on this change.

  • lauriii committed b6f4e50 on 10.1.x
    Issue #3245967 by bnjmnm, Wim Leers, nod_, lauriii, tim.plunkett,...

  • lauriii committed 94b8742 on 10.0.x
    Issue #3245967 by bnjmnm, Wim Leers, nod_, lauriii, tim.plunkett,...

  • lauriii committed 34bdf31 on 9.5.x
    Issue #3245967 by bnjmnm, Wim Leers, nod_, lauriii, tim.plunkett,...

  • lauriii committed 600da46 on 9.4.x
    Issue #3245967 by bnjmnm, Wim Leers, nod_, lauriii, tim.plunkett,...
lauriii’s picture

Version: 9.5.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed b6f4e50 and pushed to 10.1.x. Also backported to 10.0.x, 9.5.x and 9.4.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.