Problem/Motivation

The icon is not visible when added via the ckeditor plugin. The icon is white on white.
My OS is in dark mode, my admin theme is not.

icons not visible

Proposed resolution

It would be nice if the icon uses the color of the text, aka currentcolor.

Currently the icon contains the fill="currentColor" in de svg code itself. This does not work when the svg is used via background-image is css.

Converting to mask-image makes it possible the use the currentcolor in combination with setting a background-color.

icons visible

JS

In: iconify_field/modules/iconify_field_ckeditor/js/build/IconifyFieldPlugin.js

Change background-image to mask-image on line 208

CSS

In the css file: iconify_field/modules/iconify_field_ckeditor/css/iconify_field_ckeditor.css

Replace:

.ck-editor__main .iconify-field {
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  ....

With:

.ck-editor__main .iconify-field {
  background-color: currentcolor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  ....

Extra

If feel setting the vertical-align value to `-0.125em` gives a nicer alignment then the current `middle' value.

Comments

strnbrg created an issue. See original summary.

dobefu’s picture

Version: 1.0.0-rc4 » 1.0.0
Assigned: Unassigned » dobefu

Ah, that is something that I haven't yet tested properly. I will look into this after supper

dobefu’s picture

I do like the solution with the image mask, but it does break the selection outline of the elements in the CKEditor. I'll try a slightly different approach to solve both issues

dobefu’s picture

Status: Active » Fixed
Issue tags: +Accessibility

I've fixed the issue in https://git.drupalcode.org/project/iconify_field/-/merge_requests/9. I'll create a new release at the end of this weekend.

dobefu’s picture

Assigned: dobefu » Unassigned
dobefu’s picture

Status: Fixed » Closed (fixed)