Re: [editing] When should UA synthesize heights of an element? (#70)

This is a bit wider topic as for us (editor implementators) it is not only related to empty blocks, but also to the following case (`^` is a caret):

```
<ul>
    <li>1.</li>
    <li>
        ^                             // typing in the item 2.
        <ul>
            <li>2.1.</li>
        </ul>
    </li>
    <li>3.</li>
</ul>
```

Currently CKEditor uses `<br>` fillers. This indicates precisely that an empty line needs to be rendered there. I don't think that UAs may guess this as the following structure may be desirable by a content author:

```
<ul>
    <li>1.</li>
    <li>                     // no way to type here, should render normally
        <ul>
            <li>2.1.</li>
        </ul>
    </li>
    <li>3.</li>
</ul>
```

So, I can see two solutions:

1. We still use `<br>` fillers. For me it's acceptable, although this often requires a bit more coding to handle them. The implementation may therefore mark such `<br>`s with special attributes to be able to distinguish between real line breaks and `<br>` fillers. Also, if the editor implements a separate data model, the application of `<br>` fillers don't spoil the data.
2. We use empty blocks whenever we want to allow caret placement in some location. The above example would need to changed to:

```
<ul>
    <li>1.</li>
    <li>
        <p>^</p>
        <ul>
            <li>2.1.</li>
        </ul>
    </li>
    <li>3.</li>
</ul>
```

This actually sounds very well for me as I believe that inline content should not stand next to block content. However, there are problems to accept such solution spec-wide:

1. There must be a way for the developer to say that this block still should have height=0. We can't alter the CSS permanently so this must be revertable by a CSS rule. Alternative, we can tell that in order to render empty blocks correctly set `line-height: sth`. I remember from Gecko's issue tracker that this may need a new CSS height value.
2. Not everyone will be happy that a block must be created. So basically some developer will still choose to use `<br>` fillers, which is OK as well.

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/editing/issues/70#issuecomment-131777152

Received on Monday, 17 August 2015 10:45:33 UTC