YUILibrary - Open source JavaScript and CSS for building richly interactive software.
Fork YUI on GitHub

YUI 2.x

Ticket #2528028 (closed patch)

Reporter


Travis Pew
Opened: 05/27/09
Last modified: 09/14/09
Status: closed
Type: patch
Resolution: fixed

Owner


Jenny Han Donnelly
Target Release: 2.8.0
Priority: P3 (normal)
Summary: Autocomplete prehighlight not cleared in some situations
Description:

Summary


In certain circumstances, the autocomplete prehighlight is not cleared when the mouse leaves the autocomplete container. This seems to happen when there is a scrollbox. If the mouse leaves from one
LI element to the right, and re-enters to another LI element, two LI elements will be "prehighlighted".

This is because the mouseout event seems to be not triggered on the LI element (only on the container) when moving the mouse out to the right over the scrollbar. YUI Autocomplete keeps track of the
currently highlighted item, but not the currently prehighlighted item.

This proper behavior occurs for the regular "highlight". An example of highlight behavior is here:
http://developer.yahoo.com/yui/examples/autocomplete/ac_flickr_xml.html
At this link, the highlight is immediately cleared when moving the mouse to the left, but not cleared when leaving to the right (a little inconsistent, but not the main problem). When the mouse
re-enters from the right, the old highlight is cleared.

The toggleHighlight code cleans up previous items, while the togglePrehighlight code does not.

Reproducing


1. Visit the following page using Firebug:
http://developer.yahoo.com/yui/examples/autocomplete/ac_flickr_xml_clean.html

2. In the Firebug console, run the command:
YAHOO.example.ACFlickr.oAC.prehighlightClassName = "yui-ac-prehighlight";

3. Type in a word to search for.

4. Move the mouse over (but don't click) an element in the list

5. Move the mouse out to the right

6. Move the mouse back over another element

Expected Behavior


Only one element will show the "prehighlight" css class.

Actual Behavior


Two elements will show the "prehighlight" css class. The earlier element will not be cleared until the mouse passes over it.

Solution


Keep track of the current prehighlight element in addition to the current highlighted element.
Type: patch Observed in Version: 2.7.0
Component: AutoComplete Severity: S3 (normal)
Assigned To: Jenny Han Donnelly Target Release: 2.8.0
Location: Library Code Priority: P3 (normal)
Tags: Relates To:
Browsers: Firefox 3.x - PC
URL: http://developer.yahoo.com/yui/examples/autocomplete/ac_flickr_xml_clean.html
Test Information:

Attachments

Attachment #1: autocomplete-prehighlight.patch (download)

Change History

Travis Pew

YUI Contributor

Posted: 05/27/09

I would also suggest that prehighlight be cleared immediately after the mouse leaves to the right (similar to on the left), and have highlight (when no prehighlightClassName set) do the same thing. This would require only minimal further changes to the mouseout code (catch it when mouseout triggered on the container).

Jenny Han Donnelly

YUI Developer

Posted: 06/20/09
  • location changed to Library Code
  • milestone changed to 2.8.0
  • priority changed to P3 (normal)
  • status changed from new to accepted

Will investigate. Does not seem to be reproducible in FF2.

Jenny Han Donnelly

YUI Developer

Posted: 07/30/09
  • status changed from accepted to checkedin

Created commit 4c380f9: [fix bug #2528028] Explicitly clear previously prehighlighted item.

Jenny Han Donnelly

YUI Developer

Posted: 07/30/09

[fix bug #2528028] Explicitly clear previously prehighlighted item.
View Commit: 8886d0ecb2f95c4a836e19923a028b83673ac2e5

George

YUI Developer

Posted: 09/14/09
  • status changed from checkedin to closed

2.8.0 has been released. All "checkedin" items are available for download in the official release. Status of "checkedin" items is being set to closed.

George

YUI Developer

Posted: 09/14/09
  • resolution changed to fixed