Problem/Motivation

A regression in tooltip visibility surfaced when updating CKEditor 5 to v49.0.1 in #3633459: Update CKEditor to 49.1.0.
Per #13 there:

Previously in v48.5.1, the relevant CSS rules were:
https://github.com/ckeditor/ckeditor5/blob/1867f7a292a98e5740873b5f42f20...

.ck.ck-balloon-panel {
  background: var(--ck-color-panel-background);
}

and
https://github.com/ckeditor/ckeditor5/blob/1867f7a292a98e5740873b5f42f20...

.ck.ck-balloon-panel.ck-tooltip {
  --ck-color-panel-background: var(--ck-color-tooltip-background);
}

In 49.0.1, the relevant rules look like this:
https://github.com/ckeditor/ckeditor5/blob/b8cd0da471427176f4cb2c79be503...

.ck.ck-balloon-panel {
  background: var(--ck-color-panel-background, var(--ck-balloon-panel-background-color));
}

and this
https://github.com/ckeditor/ckeditor5/blob/b8cd0da471427176f4cb2c79be503...

.ck.ck-balloon-panel.ck-tooltip {
  --ck-balloon-panel-background-color: var(--ck-color-tooltip-background, var(--ck-tooltip-background-color));
}

The intent is that --ck-balloon-panel-background-color property should set the tooltip balloon bg color, but the use of --ck-color-panel-background is preserved for backwards compatibility.

Because of that BC layer, the rules in default_admin's ckeditor5.pcss.css and variables-color-semantic.pcss.css now set the background for the tooltip to white when the theme is in light mode.

.ck {
   --ck-color-panel-background: var(--admin-color-bg-raised);
}
  --admin-color-bg-raised: light-dark(var(--admin-color-white), #47474c);

With v48.5.1, the default_admin theme .ck override for --ck-color-panel-background was superseded by the value being set in a more specific selector .ck.ck-balloon-panel.ck-tooltip, but the latter was removed in v49.

To fix this, I added a css rule in default_admin to remove the BC layer:

.ck.ck-balloon-panel {
  background: var(--ck-balloon-panel-background-color);
}

Here are screenshots of what the tooltips with v49 looked like before and after the above CSS change:
Before
Light
Light mode tooltip (before)
Dark
Dark mode tooltip (before)

After
Light
Light mode tooltip (after)
Dark
Dark mode tooltip (after)

I think this is good enough to address the regression here. There can be a follow up if desired to made the tooltip colors respect light/dark mode, and/or to check whether --ck-color-panel-background should be used/overridden anymore in default_admin.

This issue is to look into whether the tooltips should have styling that changes based on light and dark mode, and also look at whether there's any use in overriding the --ck-color-panel-background property anymore.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

godotislate created an issue. See original summary.

kentr’s picture

I believe there's an accessibility issue:

The dark mode tooltip is difficult to perceive because of the low color contrast ratio between the tooltip background and what is behind it.

WCAG: SC 1.4.11 Non-text Contrast (Level AA)

IIUC color contrast issues are generally considered Major, so I suggest changing this to Major.

xjm’s picture

Priority: Normal » Major
xjm’s picture

Title: [PP-1] Make CKEditor balloon tooltips respect Admin light or dark mode » Make CKEditor balloon tooltips respect Admin light or dark mode
mherchel’s picture

The dark mode tooltip is difficult to perceive because of the low color contrast ratio between the tooltip background and what is behind it.

That only applies to controls and meaningful graphics, which the tooltip is not. IMO the main concern is that the text meets contrast (which it does). Per the SC:

The intent of this success criterion is to ensure that user interface components (i.e., controls) and meaningful graphics are distinguishable by people with moderately low vision.