[whatwg] Focus management
smfr at mac.com
Fri May 4 13:26:21 PDT 2007
Some web applications may need more control over focus than is offered
the existing focus management proposal:
over focus changes. Functionality that is missing (but often included in
native UI toolkits) includes:
* Focus chain queries
need the ability to ask the document what the next/previous
element is from a given element, or from null (first/last focusable
* Is element focusable
need to be able to ask an element if it can take focus.
currently some function of element type, tabindex, visibility,
contentEditability, UA preferenes etc, and it's hard to write JS
that computes this.
* Explicit advance/rewind focus
need to be able to move focus to the next/previous focusable
element without having explicit knowledge of what the next
element is (this mirrors what happens when the user hits the Tab
or Shift-Tab keys).
(If nextFocus()/previousFocus() are available, this could be
but that seems a little long-winded.)
In addition, I'd like to see a few clarifications in the "Focus
section of the Web Applications draft:
* What does focus() do on an unfocusable element? Does the previously
focused element remain focused?
* document.activeElement has some ambiguities:
- Is it valid when the window does not have focus?
- IE has a setActive() method that changes the activeElement, but
does not change the focus. So the activeElement is not always
the focused element.
* how does display: none or visibility: hidden interact with focus?
- if a focused element becomes unrendered, does focus move to the
next focusable element?
- can non-rendered elements be focused?
Finally I'd like to see some discussion around focus() and window
window.focus() obviously (and annoyingly) activates the window, but
focussing an element inside a window raise the window? What happens if
that window is a hidden tab in a tabbed browser?
More information about the whatwg