PDA

View Full Version : which elements can be focused?



jemptymethod
24 Nov 2009, 10:15 AM
Which elements in ExtJS are able to receive "focus"? I presume this means more than just form elements, although AFAIK the only elements that can receive focus are form elements (e.g. per http://www.w3schools.com/Html/html_eventattributes.asp).

In which case if additional elements can receive focus in ExtJS, then ExtJS's notion of focus must not be exactly the same as the HTML standard? I'm just trying to understand, and would love to know precisely which elements I can indeed focus per ExtJS's focusing methodology.

The docs for many a component unfortunately say "Try to focus this component" so I am unable to begin to discern a list of "focusable" elements from the docs. Furthermore the docs for Ext.element say "Tries to focus the element. Any exceptions are caught and ignored." but I could see a very useful alternative to this approach that at least returns some kind of actionable information when we "try to focus", and that is, focus() should return a boolean as to whether the focus succeeded.

aconran
24 Nov 2009, 10:32 PM
Anchor tags and form elements can be focused.

You cannot determine whether a focus request was successful (in fact we throw away any possible errors that may occur when you try to focus an element). Some components we create a focusEl for the very purpose of allowing the component to receive focus to intercept keyboard event handlers such as the grid and window.