Ah, yes .. the lovely auto-complete. I can’t imagine using any program for sending invitations that doesn’t have a fast way to locate your contacts. Which is exactly why, if you’re a registered user, when you are inviting guests we use auto-complete to help you quickly locate your contacts. Furthermore we allow tags to be assigned to contacts, and those tags show up in the auto-complete as well. So if you had a friend named “Joysake Muroo <jmuroo@jjjmmdd.com>” and a tag “joyofsakefriends” when you type in “sake” both of them will show up. Alright, so that’s the fun part.
We had 2 less fun things (problems) that I found annoying. The first problem was if you are a keyboard user and on FireFox, and used the up and down arrows in the auto-complete box when you hit the up arrow the entire window would jump. Thanks for this scriptaculous
So after one evening of getting fed up with this I planned to fix it. I found a great simple solution.
Open up controls.js, go to the markPrevious function and change the last line to use false instead of true when calling scrollIntoView.
That’s it. I assume this line is used to support some corner case that doesn’t effect us. I tested all our auto-complete boxes against all our supported browsers and all is good. Problem #1 solved.
Problem #2. We also enable auto-complete for registered users to invite other people to a party they’ve been invited to. The problem with this is that the invite others box comes up through an ajax request. This is a problem because no matter what I did I wasn’t able to get the auto-complete javascript to fire when embedded in a script tag with-in the partial. There are multiple ways we could have fixed this. One being, don’t use ajax, and simply toggle the visibilty of the box when “invite others” is clicked, but I wanted to avoid loading the script if the person was just viewing the page. The solution we went with was when the user clicks in the auto-complete textbox it loads at that moment (onfocus). I’m not so excited about this one, but it has been working fine for some weeks now.
So .. go play with our auto-complete and see what you think .. and if you like it then get yourself some scriptaculous
