In certain situations, pressing enter while an auto-complete field is searching produces unexpected browser behavior. I've tested this in Firefox 2.0.0.1 and Safari 2.0.4 on Mac OS X.

Here are the steps to reproduce this problem.

  1. Enter a few charecters into an auto-complete field. The the field will start searching for suggestions.
  2. Quickly press enter before any suggestions appear.
  3. Observe one of two behaviors (both pictured in the screenshot).

It's sometimes difficult to get the behavior, but I've found that occurs consistently when there is more than one potential auto-completion.

CommentFileSizeAuthor
#1 autocomplete-enter.patch768 bytesSteven
ac-ff-enter-bug.png36.69 KBWill White

Comments

Steven’s picture

Priority: Normal » Critical
Status: Active » Needs review
StatusFileSize
new768 bytes

The behaviour is actually perfectly normal :). Observe.

autocomplete.js contains the code:

      $(this.popup).empty().append(ul).show();

If you press enter while the results are being fetched, the popup is closed. this.popup is set to null. In jQuery $(null) is a shorthand for $(document), so we're asking for the document to be cleared and the results to be inserted in it. The other code path (for no results) hides the popup/document by settings its visibility to hidden. This might explain the white blank too.

Patch attached.

Anonymous’s picture

confirmed fixed.

+1

heine’s picture

Patch in #1, solves the issue in Opera 9.1 and IE 7.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

steven wrote it. steve confirms. thats rtbc.

Anonymous’s picture

hahaha.

I tested it in Safari, Firefox (both pc and mac, 1.5 and 2.0) and IE 6.

drumm’s picture

Committed to HEAD.

drumm’s picture

Status: Reviewed & tested by the community » Fixed
BioALIEN’s picture

Status: Fixed » Closed (duplicate)

I wanted to highlight my comment which is directly related to this issue:
http://drupal.org/node/107591#comment-175902