[whatwg] HTML5 - 7.4.2 Focus management

Ian Hickson ian at hixie.ch
Thu Dec 30 18:11:43 PST 2010


On Thu, 23 Sep 2010, Guilherme Johansson Tramontina wrote:
>
> I saw that elements with the "draggable" attribute become focusable.
> But what about "contenteditable"?

Yes. (I've clarified the spec to make this more obvious.)


> My main questions/suggestions are:
>  - Should the contenteditable element be focusable?

Yes (modulo platform conventions).


>  - And its children elements?

Technically, it's the editing host that's focusable.


>  - How about events (like onChange) for the editable element and/or
> for its children?

How do you mean?


> Here is a simple HTML example:
> <ol contenteditable='true'>
>     <li>Item 1</li>
>     <li>Item 2</li>
>     <li>Item 3</li>
> </ol>
> 
> By default none of this elements are focusable, correct?

Not without the contenteditable="" attribute, no.


> If I bind an onFocus/onBlur event handlers on the OL element, both get
> triggered when I click on it and off it... Which means that it became
> focusable due to the contenteditable attribute!

The editing host (the <ol> element) is focusable, otherwise it wouldn't be 
editable, yes.


> Going further, if I turn the LI elements focusable by adding the
> "tabindex='-1'" attribute and also bind onFocus/onBlue event handlers
> on them, when I click any LI item, here is what is currently
> happening:
>  - In Chrome (can't remeber version), this is the event order: LI's
> onFocus -> LI's onBlur -> OL's onFocus;
>  - In Firefox (can't remeber version), the only event triggered is LI's onFocus;

I don't really know what it would mean to focus the <li> elements if the 
<ol> was already focused, really. I mean, everything that's editable has 
to be reachable by the cursor (i.e. focusable), right? It's just part of 
being editable.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list