]> source.dussan.org Git - jquery-ui.git/commitdiff
fixed: problem with focus and positioning in IE on slow machines, thanks to greenish...
authorFelix Nagel <info@felixnagel.com>
Sat, 16 Apr 2011 13:52:31 +0000 (15:52 +0200)
committerFelix Nagel <info@felixnagel.com>
Sat, 16 Apr 2011 13:52:31 +0000 (15:52 +0200)
ui/jquery.ui.selectmenu.js

index fc476956d0b8caffa04dc944d530401c51d31d45..7c0f61a7a9b29d86893caadf5c99488530d27d38 100644 (file)
@@ -507,13 +507,14 @@ $.widget("ui.selectmenu", {
                        } else {
                                this.list.appendTo('body');
                        }
-                       this.list.addClass(self.widgetBaseClass + '-open')
-                               .attr('aria-hidden', false)
-                               .find('li:not(.' + self.widgetBaseClass + '-group):eq(' + this._selectedIndex() + ') a')[0].focus();
+                       
+                       this.list.addClass(self.widgetBaseClass + '-open').attr('aria-hidden', false);
+                       // FIX IE: Refreshing position before focusing the element, prevents IE from scrolling to the focused element before it is in position.
+                       this._refreshPosition();
+                       this.list.find('li:not(.' + self.widgetBaseClass + '-group):eq(' + this._selectedIndex() + ') a')[0].focus();
                        if ( this.options.style == "dropdown" ) {
                                this.newelement.removeClass('ui-corner-all').addClass('ui-corner-top');
                        }
-                       this._refreshPosition();
                        this._trigger("open", event, this._uiHash());
                }
        },