W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2010

[whatwg] HTML5 - 7.4.2 Focus management

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 31 Dec 2010 02:11:43 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1012310120470.28593@ps20323.dreamhostps.com>
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.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 30 December 2010 18:11:43 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:29 UTC