patches to autocompleter

30 views
Skip to first unread message

wanto

unread,
Jan 11, 2012, 11:41:19 PM1/11/12
to Prototype & script.aculo.us
Hi all,

I've been using the autocompleter in a production environment of a
large company's site which receives quite a lot of traffic.

As a result, I've found a couple of problems with the implementation
which have required patching. I thought I'd share these here incase
someone wants to fix the base implementation for a future release.

I apologise in advance for not having the time to put together a test-
case or proof at present . I might get around to it later.

Victor

unread,
Jan 12, 2012, 1:13:59 AM1/12/12
to prototype-s...@googlegroups.com
Hello!

...everyone who was using autocompleter in production has a couple of patches :(

let's start to share?

ben

unread,
Jan 13, 2012, 9:34:18 AM1/13/12
to Prototype & script.aculo.us
I've been struggling with this for the past couple of weeks as well.
One of the big issues I rand into was the way different browsers
handle scrolling the results window, and how the window controls is
treated as a loss of focus in some browsers.

I implemented the code Craig posted in this thread from 2/2009:
http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/ee29de995b4e000d

... but that introduced some other aberrant behavior, such as the
results box not going away after selection.

Would love to see how other people have solved some of these issues.

Victor

unread,
Jan 16, 2012, 5:58:11 AM1/16/12
to prototype-s...@googlegroups.com
Hello!


One of the big issues I rand into was the way different browsers
handle scrolling the results window, and how the window controls is
treated as a loss of focus in some browsers.
 
Do you can describe this with more words? I cannot remember such problem, at least as the "big issue".

I implemented the code Craig posted in this thread from 2/2009:
http://groups.google.com/group/prototype-scriptaculous/browse_thread/thread/ee29de995b4e000d

... but that introduced some other aberrant behavior, such as the
results box not going away after selection.

selection by mouse click or key press?
 
Would love to see how other people have solved some of these issues.

1. Replaced some of deprecated Position.xxx methods
2. Wrapped update.clonePosition in try-catch - source of frequent IE errors with Prototype < 1.7
3. Replaced bindAsEventListener() with bind()
4. Modified keyboard observers: keypress for ENTER/ESC in IE, keydown for ESC in WebKit and keydown for the rest of keys
5. iframe shim only for IE6, not for IE7+
6. Proper z-index for iframe
7. Fixed bug in getEntry() for empty this.update
8. Added scrollIntoView() in updateChoices()
9. Fixed bug with invalid cached tokenBounds in getTokenBounds()

ben

unread,
Jan 17, 2012, 10:54:47 AM1/17/12
to Prototype & script.aculo.us
On browsers other than FF, clicking on the scroll bar would cause a
loss of focus, which would hide the results window. The scroll wheel
worked fine IIRC, but in Chrome and IE it would just vanish. I've
never tested the key commands extensively.

Selection by mouse click does not dismiss the window, although now
that I think about it, it might be the way I'm using the control; I
tend to put javascript actions in the search results, as opposed to
using the built-in callback function. I'll have to take a look at this
and see if it's an error on my part.

Victor

unread,
Jan 20, 2012, 3:46:12 AM1/20/12
to prototype-s...@googlegroups.com

On browsers other than FF, clicking on the scroll bar would cause a
loss of focus, which would hide the results window.

I've fixed this too ;)

controls.js
Reply all
Reply to author
Forward
0 new messages