Re: Should we take CSS into consideration? (was: Re: attribute or CSS property?)

On Wed, Dec 10, 2014 at 8:03 AM, Johannes Wilm <johannes@fiduswriter.org>
wrote:
>
> Hey,
> so there seems to be a majority for going with an attribute rather a CSS
> property when it comes to assigning editability.
>
> Another somewhat question seems to have come up a few times over the last
> few days without being discussed directly is how CSS should or shouldn't
> influence contenteditable=typing.
>
> *AGAINST:* Piotr mentioned some reasons not to take CSS into
> consideration: "We are often traversing DOM to check whether some element
> is inside editable container or not and we do that also on detached DOM
> (when processing input/output data). If we would need to check computed
> styles I think it would be both - slower and/or more limited/complicated.
> [...] Visibility does not affect editability -
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=25908". The mentioned link
> mentions a case where a contenteditable element was inside of a dom element
> that was hidden with display:none and was making the point that the
> contenteditable element should still work as normal.
>
> *FOR:* Olivier mentioned a display:none node inside of a
> contenteditable=typing, which he believes should be treated as if it didn't
> exist (
> https://github.com/w3c/selection-api/issues/27#issuecomment-65961041 )
>

I could put a finer point on this: I think display:none elements inside
cE=typing should be treated as if they didn't exist  only in terms of caret
movement. I agree with Piotr that display:none should not magically turn
off editability flag.

I probably said in a few emails that display:none elems should be
non-editable. I think the more correct behavior is that they are not
caret-accessible. You can't click on them (obviously), you can't use arrow
keys to get to them, etc..

However if you programmatically set the selection in a display:none I think
we could discuss what the behavior is. (does it fire typing intents? Does
it fire caret movement intents even though there is no visible caret?) But
let's discuss this elsewhere.

The point as it relates to this email is that if display:none only affects
caret movement, then it is only relevant when that markup is in the DOM as
part of the document. And in that case you can determine visibility very
easily.


and Federico thinks that carets should behave different for some types of
> display:inline-block elements ("I understand that there may be situations
> where you want to style non editable blocks in a more evident way to the
> user, with borders, padding, etc… so it sounds reasonable for me that if
> the outer <span cE=false> has the “display” style set to anything that is
> not “inline”, like "inline-block”, the movement would count as a in-between
> blocks move, so the caret will be before “b”. This would be a good way to
> bring developers control over this behavior.")
>

It appears Federico's point applies to caret movement only as well. Would
everybody be OK if editability was not affected by CSS but caret movement
was? That way you could traverse the DOM to know if something should be
editable or not even if not part of the document. You just wouldn't know
exact caret behavior until you can apply the CSS.



>
> I can see good arguments for both positions, but I think we should try to
> be consistent in some way. Think of this example:
>
> <div style="display:none;">
>   <div contenteditable=true>
>     Hello <span style="display:none">Austria</span>!
>   </div>
> </div>
>
>
> We could of course combine the two proposals above, but it would then seem
> to mean that we start to operate with several layers of
> display-none-ishness, which I'm not sure was intended.
>
> --
> Johannes Wilm
> Fidus Writer
> http://www.fiduswriter.org
>

Received on Monday, 15 December 2014 17:40:19 UTC