Changes

Jump to: navigation, search

XUL:Focus Behaviour

2,635 bytes added, 18:30, 16 April 2007
no edit summary
browser, editor, iframe
 
==How focus should behave in 2.0==
 
Two attributes are used to specify how focus behaves on an element, <code>focusable</code> and <code>tabindex</code>. A focusable property is added to nsIDOMXULElement. It is a string with three possible values: '<code>false</code>', '<code>true</code>' or '<code>auto</code>'.
 
On setting the focusable property, it should change the value of the focusable attribute on that element to the same value. On retrieving, it should retrieve the value of the focusable attribute on that element.
 
If the value of the focusable property is not the string 'true' or the string 'false', then the value 'auto' is assumed. Thus, the 'auto' value is the default if the focusable attribute is not specified. The focusable attribute should not be specified when the value is 'auto'.
 
When the focusable property is 'false', the element cannot be focused by any means. The tab index of the element is ignored and the element is skipped in the tab order.
 
When the focusable property is 'true', the element may be focused by clicking it with the mouse. The used tab index is determined as follows:
 
*if the element implements the nsIDOMXULControlElement interface, the value of the tabIndex property of that interface is the used tab index.
*otherwise, if the element has a tabindex attribute set to a non-negative integer, that value is the used tab index.
*otherwise, the used tab index is -1.
 
When the focusable property is 'auto', the focusability is determined from the tab index. The used tab index is determined as follows:
 
*if the element implements the nsIDOMXULControlElement interface, the value of the tabIndex property of that interface is the used tab index. The element is focusable, and the used tab index affects the tabbing order.
*otherwise, if the element has a tabindex attribute set to a non-negative integer, that value is the used tab index. The element is focusable, and the used tab index affects the tabbing order.
*otherwise, the used tab index is -1 and the element is not focusable.
 
When the used tab index is -1, the element is not part of the tab order, but may still be focusable. When the used tab index is a non negative integer, it becomes part of the tab order.
 
The default implementation of the getter for the tabIndex property of the nsIDOMXULControlElement interface is:
 
*if the tabindex attribute is set to a positive integer or -1, return that value.
*otherwise, return 0.
 
The -moz-user-focus CSS property is obsolete and does nothing (or for compatibility, the value 'ignore' is treated as focusable='false' and the value 'normal' is treated as focusable='auto').
287
edits

Navigation menu