Ext.getBody().focus() not working in IE6
-
19-09-2019 - |
Question
Ext.getBody().focus()
does not appear to be working correctly in IE6. When a user navigates to a new ExtJS tab, I need to ensure he can no longer type into a CKEditor instance (hidden after navigating to a new tab) in which he might have been typing. The following code works in FF, but not IE6.
for( var instanceName in CKEDITOR.instances ) {
CKEDITOR.instances[instanceName].focusManager.forceBlur(); // also
// not working
// in IE6
}
Ext.getBody().focus();
Any suggestions?
Solution 2
I used this workaround; I created an input field with zero height and zero width and move the focus to this field to blur a CKEditor field/instance.
OTHER TIPS
I believe all major browsers including IE 6 support the document.activeElement property. If I understand correctly, you need to remove focus from the active form element when the user clicks a tab? Assuming you have access to some sort of event when the tab is clicked, try this:
if(document.activeElement) {
//Call blur() to remove focus from the active (focused) element
document.activeElement.blur();
}
If you want to disable all input to that field you would want to also give it the "disabled" property.