Ckeditor5: The nested editable selection indicator is broken

Created on 19 Jun 2018  Â·  4Comments  Â·  Source: ckeditor/ckeditor5

When there are colspans/rowspans in cells the border-based selection is messed up:

selection_041

I've found that the box-shadow: inset plays well:

selection_042

I've used this:

.ck-widget.table {
    & td,
    & th {
        &.ck-editor__nested-editable.ck-editor__nested-editable_focused {
            border-style: none;
            box-shadow: var(--ck-inner-shadow), 0 0, inset 0px 0px 0 1px var(--ck-color-focus-border);
        }
    }
}
table improvement

Most helpful comment

To reiterate an earlier comment on this:

Use outline instead of border:
https://codepen.io/david-twist/pen/NMQOwO?editors=1000

.highlight {
  outline: 1px solid var(--ck-color-focus-border);
  outline-offset: -1px; /* progressive enhancement - no IE support */
  box-shadow: inset 0px 2px 3px 1px rgba(0, 0, 0, .1);
  background-color: rgba(71, 164, 245, .2) !important;
}

[edited example style to align with the design intent of current approach— I added a background color and subtle inner shadow, as I think it helps with comprehension]

All 4 comments

Let's try to fix it if @jodator's patch is ok. If not, we don't have to prioritise it.

To reiterate an earlier comment on this:

Use outline instead of border:
https://codepen.io/david-twist/pen/NMQOwO?editors=1000

.highlight {
  outline: 1px solid var(--ck-color-focus-border);
  outline-offset: -1px; /* progressive enhancement - no IE support */
  box-shadow: inset 0px 2px 3px 1px rgba(0, 0, 0, .1);
  background-color: rgba(71, 164, 245, .2) !important;
}

[edited example style to align with the design intent of current approach— I added a background color and subtle inner shadow, as I think it helps with comprehension]

Below is a comparison of a highlighting solutions on different browsers:

  1. Current:

Chrome | Firefox | Edge
-----------|-----------|-------
selection_076 | selection_072 | selection_073

  1. Using box-shadow:

Chrome | Firefox | Edge
-----------|-----------|-------
selection_077 | selection_071 | selection_074

  1. Using outline:

Chrome | Firefox | Edge
-----------|-----------|-------
selection_078 | selection_069 | selection_075


From the above:

  1. The current solution is broken on Chrome - no go.
  2. The box-shadow solution is slightly worse (on Edge) from others and doesn't look so nice (also the upper shadow sometimes get lost on Edge).
  3. Looks nice everywhere IMHO.

I'd go with @dtwist solution:

.ck-widget.table {
    & td,
    & th {
        &.ck-editor__nested-editable.ck-editor__nested-editable_focused {
            border-style: none;
            outline: 1px solid var(--ck-color-focus-border);
            outline-offset: -1px; /* progressive enhancement - no IE support */
        }
    }
}

@oleq & @dkonopka Let me know if you wish to change the background as well.

The solution is not perfect because there's often a border next to the outline but it definitely looks better than it used to.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

devaptas picture devaptas  Â·  3Comments

jodator picture jodator  Â·  3Comments

msamsel picture msamsel  Â·  3Comments

MansoorJafari picture MansoorJafari  Â·  3Comments

pomek picture pomek  Â·  3Comments