<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -86,7 +86,7 @@ input.textfield{
 .autocomplete ul.auto-dropdown li:first-child{
   border-top:none;
 }
-.autocomplete ul.auto-dropdown li:hover, .autocomplete ul.auto-dropdown li.highlighted{
+.autocomplete ul.auto-dropdown li.highlighted{
   background:#fdffe5;
 }
 .autocomplete ul.auto-dropdown li strong{</diff>
      <filename>examples/styles.css</filename>
    </modified>
    <modified>
      <diff>@@ -128,5 +128,15 @@ describe(&quot;Keyboard Interaction&quot;, {
     input.fireEvent('keyup', {key: 'up'});
     input.fireEvent('keyup', {key: 'up'});
     value_of(Instance.highlightedChoice).should_be(dropdown.getElements('li')[0]);
+  },
+  
+  'should highlight the choice while hovering': function(){
+    dropdown.getElements('li')[2].fireEvent('mouseover');
+    value_of(Instance.highlightedChoice).should_be(dropdown.getElements('li')[2]);
+  },
+  'should move the keyboard from where the mouse is hovering': function(){
+    dropdown.getElements('li')[2].fireEvent('mouseover');
+    input.fireEvent('keyup', {key: 'up'});
+    value_of(Instance.highlightedChoice).should_be(dropdown.getElements('li')[1]);
   }
 });
\ No newline at end of file</diff>
      <filename>spec/specs.js</filename>
    </modified>
    <modified>
      <diff>@@ -108,55 +108,59 @@ var SelectAutocompleter = new Class({
   },
   
   keyListener: function(event){
+    // Escape means we want out!
     if (event.key == &quot;esc&quot;){
       this.onBlur();
       this.element.blur();
-    }else if(event.key == &quot;up&quot;){
+    
+    // Up/Down arrows to navigate the list
+    }else if(event.key == &quot;up&quot; || event.key == &quot;down&quot;){
       var choices = this.dropDown.getElements('li');
       if (choices.length == 0) return;
       
-      if (this.highlightedChoice == null){
-        this.highlightedChoice = choices[0];
-        this.highlightedChoice.addClass('highlighted');
-      }else{
-        this.highlightedChoice.removeClass('highlighted');
-        if (choices.indexOf(this.highlightedChoice) == -1 || choices.indexOf(this.highlightedChoice) == 0){
-          this.highlightedChoice = choices[0];
-          this.highlightedChoice.addClass('highlighted');
-        }else{
-          this.highlightedChoice = choices[choices.indexOf(this.highlightedChoice) - 1];
-          this.highlightedChoice.addClass('highlighted');
-        }
+      // If there's no previous choice, or the current choice has been filtered out
+      if (this.highlightedChoice == null || choices.indexOf(this.highlightedChoice) == -1){
+        this.highlight(choices[0]);
+        return;
       }
       
-    }else if(event.key == &quot;down&quot;){
-      var choices = this.dropDown.getElements('li');
-      if (choices.length == 0) return;
-      
-      if (this.highlightedChoice == null){
-        this.highlightedChoice = choices[0];
-        this.highlightedChoice.addClass('highlighted');
-      }else{
-        this.highlightedChoice.removeClass('highlighted');
-        if (choices.indexOf(this.highlightedChoice) == -1){
-          this.highlightedChoice = choices[0];
-          this.highlightedChoice.addClass('highlighted');
-        }else if(choices.indexOf(this.highlightedChoice) == choices.length - 1){
-          this.highlightedChoice = choices[choices.length - 1];
-          this.highlightedChoice.addClass('highlighted');
-        }else{
-          this.highlightedChoice = choices[choices.indexOf(this.highlightedChoice) + 1];
-          this.highlightedChoice.addClass('highlighted');
-        }
+      switch(event.key){
+        case &quot;up&quot;:
+          // Are we at the top of the list already?
+          if (choices.indexOf(this.highlightedChoice) == 0){
+            this.highlight(choices[0]);
+          // Otherwise, move down one choice
+          }else{
+            this.highlight(choices[choices.indexOf(this.highlightedChoice) - 1]);
+          }
+        break;
+        case &quot;down&quot;:
+          // Are we at the bottom of the list already?
+          if(choices.indexOf(this.highlightedChoice) == choices.length - 1){
+            this.highlight(choices[choices.length - 1]);
+          // Otherwise, move up one choice
+          }else{
+            this.highlight(choices[choices.indexOf(this.highlightedChoice) + 1]);
+          }
+        break;
       }
+    
+    // Select an item through the keyboard
     }else if (event.key == &quot;return&quot; || event.key == &quot;enter&quot;){
       this.termChosen = this.highlightedChoice.getAttribute('rawText');
       this.element.blur();
+      
+    // Regular keys (filtering for something)
     }else{
       this.updateTermsList();
     }
   },
   
+  highlight: function(elem){
+    if (this.highlightedChoice) this.highlightedChoice.removeClass('highlighted');
+    this.highlightedChoice = elem.addClass('highlighted');
+  },
+  
   updateTermsList: function(){
     var filterValue = this.element.get('value');
     this.buildFilteredTerms(filterValue);
@@ -200,6 +204,8 @@ var SelectAutocompleter = new Class({
       choice.addEvent('click', function(){
         this.termChosen = scoredTerm[1];
       }.bind(this));
+      choice.addEvent('mouseover', this.highlight.bind(this, choice));
+      
       this.dropDown.appendChild(choice);
     }, this);
   },</diff>
      <filename>src/select_autocompleter.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>12c3b827d44d442e3e782a7d0c4d8d3ac392eed2</id>
    </parent>
  </parents>
  <author>
    <name>Kyle Neath</name>
    <email>kneath@gmail.com</email>
  </author>
  <url>http://github.com/kneath/select-autocompleter/commit/660dff371a84eff1f8fcc39268db91cfb276ee5a</url>
  <id>660dff371a84eff1f8fcc39268db91cfb276ee5a</id>
  <committed-date>2008-09-26T23:25:57-07:00</committed-date>
  <authored-date>2008-09-26T23:25:57-07:00</authored-date>
  <message>Make the keyboard interactions and mouse interactions happy with each other</message>
  <tree>66c9849badaed28a9dbd14a66333004c8650c9c6</tree>
  <committer>
    <name>Kyle Neath</name>
    <email>kneath@gmail.com</email>
  </committer>
</commit>
