From 915cdd72c128e13fdf74d98f4bc6b3100c3b00e9 Mon Sep 17 00:00:00 2001 From: "Philipp C. Adrian" Date: Fri, 1 Apr 2011 13:23:17 -0400 Subject: [PATCH] FIX IE: Refreshing position before focusing the element. Prevents IE from scrolling to the focused element before it is in position. Signed-off-by: Philipp C. Adrian --- ui/jquery.ui.selectmenu.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 537d6f39408..3fedc16b8eb 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -508,12 +508,14 @@ $.widget("ui.selectmenu", { 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(); + .attr('aria-hidden', false); + // (Philipp C. Adrian) 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()); } },