Ticket #1486 (closed bug: fixed)
Triggering focus to hidden elements does not work in IE
|Reported by:||himynameiznate||Owned by:||brandon|
If you try to trigger the focus of a field that is hidden (whether it's hidden on it's own, or hidden because the parent element(s) are hidden), IE will throw the following error:
"Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."
Using .is(':visible') won't work, because the container(s) could be hidden.
However, the fix is pretty simple, by editing the jQuery event core, inside of the trigger method, change this line:
if ( fn && val !== false && !jQuery.nodeName(element, 'a') ) element[ type ]();
if ( fn && val !== false && !jQuery.nodeName(element, 'a') && !(type == 'focus' && element.offsetHeight == 0) ) element[ type ]();
Of course, I haven't tested this completely thoroughly, but overall, it shouldn't break anything.
- Component changed from core to event
- Milestone changed from 1.1.4 to 1.2.2