View Full Version : Where is Ext.FocusManager.subscribe()?

7 Nov 2011, 11:35 AM
Looks to me like Ext.FocusManager.subscribe() and .unsubscribe() have mysteriously disappeared in 4.1, though references to them still exist in the class-level documentation for FocusManager. Is this intentional? If so, is there a suitable alternative to use instead?

10 Nov 2011, 11:26 PM
Thanks! This was unintentional - an artifact of accessibility work that we had started and de-scoped from 4.1. We need to restore FocusManager to its 4.0 state before we ship 4.1.

10 Nov 2011, 11:28 PM
This ticket is EXTJSIV-4445

11 Nov 2011, 10:28 AM
Excellent, thanks for clearing up the mystery! :)

23 Nov 2011, 11:12 AM
subscribe is no longer required.

FocusManager used to have to be "pointed at" a Container (subscribed to the Container), and it would dig out all descendant Components and add listeners to both the descendant's element and the descendant Component itself.

And it also then had to monitor for adds and removes within that Container tree.

Not that efficient.

Now, AbstractComponent's onFocus and onBlur template methods are called on focus and blur of the Component's getFocusEl(). This is part of the natural functionality of Components. Non-focusable Components won't implement getFocusEl, and so will not be part of the focus tree. Containers are focusable so that you can navigate between and into them.

So now, FocusManager hooks directly into AbstractComponent's template methods and sees what is being focused.

So once it's enabled it globally tracks focus, and adds framing which follows focus, and allows navigation into the Container->Component tree.

23 Nov 2011, 11:17 AM
Very cool, thanks Animal! That certainly makes things easier all-around. :)

7 Jul 2013, 5:54 PM
So if we are to use a non focus-able component in a window does this mean that Ext.FocusManager.enable() has to be called in the initComponent and disable() in the destroy?
Is there a performance hit if it turned on for the entire application?

12 Dec 2013, 7:42 AM
You can enable it in app.js - launch.