Skip to content

Instantly share code, notes, and snippets.

@rgrove
Created February 15, 2012 20:22
Show Gist options
  • Save rgrove/1838761 to your computer and use it in GitHub Desktop.
Save rgrove/1838761 to your computer and use it in GitHub Desktop.
Monkeypatch for YUI AutoComplete 3.4.x list being hidden after scrolling using a scrollbar on the contentBox
Y.AutoCompleteList.prototype._bindList = function () {
this._listEvents.concat([
Y.one('doc').after('click', this._afterDocClick, this),
Y.on('windowresize', this._syncPosition, this),
this.after({
blur : this._afterListBlur,
focus : this._afterListFocus,
mouseover: this._afterMouseOver,
mouseout : this._afterMouseOut,
activeItemChange : this._afterActiveItemChange,
alwaysShowListChange: this._afterAlwaysShowListChange,
hoveredItemChange : this._afterHoveredItemChange,
resultsChange : this._afterResultsChange,
visibleChange : this._afterVisibleChange
}),
this._listNode.delegate('click', this._onItemClick,
this['_SELECTOR_ITEM'], this)
]);
};
Y.AutoCompleteList.prototype._afterDocClick = function (e) {
var boundingBox = this._boundingBox,
target = e.target;
if (target !== this._inputNode && target !== boundingBox &&
!boundingBox.one(target.get('id'))) {
this.hide();
}
};
Y.AutoCompleteList.prototype._afterMouseOut = function () {
this._mouseOverList = false;
this._set('hoveredItem', null);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment