Author: jcompagner Date: Wed Sep 24 08:31:07 2008 New Revision: 698612 URL: http://svn.apache.org/viewvc?rev=698612&view=rev Log: 2 patches one being WICKET-1827
Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js?rev=698612&r1=698611&r2=698612&view=diff ============================================================================== --- wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js (original) +++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/wicket-autocomplete.js Wed Sep 24 08:31:07 2008 @@ -52,7 +52,6 @@ var objonkeypress; var objonchange; var objonchangeoriginal; - var objonfocus; // holds the eventual margins, padding, etc. of the menu container. // it is computed when the menu is first rendered, and then reused. @@ -79,7 +78,6 @@ objonblur=obj.onblur; objonkeyup=obj.onkeyup; objonkeypress=obj.onkeypress; - objonfocus = obj.onfocus; // WICKET-1280 objonchangeoriginal=obj.onchange; @@ -150,10 +148,13 @@ switch(wicketKeyCode(Wicket.fixEvent(event))){ case KEY_ENTER: return killEvent(event); + case KEY_TAB: + if (cfg.showListOnFocusGain) + updateChoices(); + break; case KEY_UP: case KEY_DOWN: case KEY_ESC: - case KEY_TAB: case KEY_RIGHT: case KEY_LEFT: case KEY_SHIFT: @@ -176,12 +177,6 @@ } if(typeof objonkeypress=="function")objonkeypress(event); } - - obj.onfocus=function(event){ - if (cfg.showListOnFocusGain) - updateChoices(); - if(typeof objonfocus=="function")objonfocus(); - } } function handleSelection(input) { @@ -276,7 +271,7 @@ var input=wicketGet(elementId); var index=getOffsetParentZIndex(elementId); container.show(); - container.style.zIndex=(Number(index)!=Number.NaN?Number(index)+1:index); + container.style.zIndex=(!isNaN(Number(index))?Number(index)+1:index); container.style.left=position[0]+'px' container.style.top=(input.offsetHeight+position[1])+'px'; if(cfg.adjustInputWidth) @@ -310,7 +305,7 @@ // check if the input hasn't been cleared in the meanwhile var input=wicketGet(elementId); - if (!cfg.showListOnEmptyInput && (input.value==null || input.value=="")) { + if ((Wicket.Focus.getFocusedElement() != input) || !cfg.showListOnEmptyInput && (input.value==null || input.value=="")) { hideAutoComplete(); return; }