Ticket #6767 (closed bug: duplicate)
Using focus() after slideDown() causes element to disappear in IE6 & IE7
| Reported by: | Alistair | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.next |
| Component: | effects | Version: | 1.4.2 |
| Keywords: | sliding | Cc: | |
| Blocking: | Blocked by: |
Description
A slideDown() is executed on a DIV element surrounding an INPUT element. Within the slideDown callback function, the INPUT element is given focus with the focus() method. At that point the element disappears. If the focus() is not done, the slidedown works ok and the element remains visible.
The fix is to use .get(0).focus() instead of .focus(). That is, use the DOM's focus method directly instead of jQuery's. When this is done, the problem does not occur and the element remains visible.
Complete demo HTML is here: http://tinypaste.com/6c8ae
Occurs in IE6 and 7. Seems ok in IE8.
Attachments
Change History
Changed 3 years ago by Alistair
-
attachment
testslide.html
added
comment:1 Changed 3 years ago by Alistair
I also found that, in the attached demo HTML, if you remove the "float:left" from the style ".fldcol", then the problem goes away.
So perhaps it's something related to adjacent floats in IE7.
Still, it's unusual that the .focus() method causes/triggers the problem, not the slideDown() itself.
comment:2 Changed 3 years ago by rwaldron
- Priority set to low
- Status changed from new to open
- Component changed from manipulation to effects
- Milestone 1.4.3 deleted
Confirmed (exists with 1.4.4git)
comment:3 Changed 2 years ago by tomgrohl
Tested this using 1.5.1 and still doesn't work.
Although this isn't a jQuery bug though, its a IE Css bug.
If you have an element with margin then you need to add display: inline or inline-block otherwise the elements position gets messed up.
I added display: inline-block to the css and it works fine (Tested in IE 6 and 7.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Demo of bug