Re: [editing] nested contenteditable

On Thu, May 30, 2013 at 3:52 AM, Aryeh Gregor <ayg@aryeh.name> wrote:

> On Tue, May 28, 2013 at 8:27 PM, Travis Leithead
> <travis.leithead@microsoft.com> wrote:
> > As far as I know, there is no actively maintained editing spec at the
> > moment. Aryeh’s document is a great start but by no means should it be
> > considered complete, or the standard to which you should target an
> > implementation… I think we would [currently] prefer to discuss specific
> > issues here on the mailing list until a regular editor can be found—so
> > thanks for bringing this up!
> >
> >
> >
> > By the way, what you suggest sounds reasonable for the behavior.
>
> Agreed on all points, FWIW.  I'm not totally sure what the most
> sensible behavior is for backspacing into a non-editable element is,
> but selecting is a reasonable idea that the spec already recommends
> for tables (although I don't think anyone implements that point last I
> checked).  It makes it clear that the next backspace will delete the
> whole thing, which would otherwise be very surprising -- e.g., suppose
> it were a simple run of text that wasn't visually distinguishable from
> the surrounding editable content.
>

The main use case I can think of for mixed editability is an image with a
caption. If anyone has other use-cases, that would be helpful in reasoning
about this. http://jsfiddle.net/UAJKe/

Looking at that, I think we should make it so that a selection can never
cross an editing boundary. So, in the image caption example, put your
cursor right before the uneditable div, then:
1. Right arrow should move your cursor into the caption text.
2. Shift+right arrow should select the whole uneditable div.

And delete/backspace can just be defined as extending the selection one
position and then removing the selected DOM. Relatedly, if you are at the
beginning of the caption text and hit backspace, nothing happens because
the backspace had nothing to select (i.e. selections are contained within
their first contentEditable=true ancestor).

As to the question of whether delete/backspace should select or remove
non-editable elements, I'm not opposed to giving this a try in Chromium and
seeing if users are confused by it, but I'm skeptical it will make sense to
people.

Received on Friday, 31 May 2013 22:28:49 UTC