Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete fixes and enhancements #533

Merged
merged 1 commit into from
Dec 10, 2015

Conversation

EreMaijala
Copy link
Contributor

Switched to trigger() for the selection event so that it can be bound to with the bind() function and the initialization function doesn't need to be modified.
Moved the autocomplete window to the form so that the bounding rect is not needed thus avoiding positioning problems e.g. when window is scrolled while suggestions are loading.
Align suggestions when window is resized.
Set the initial content with .html().
Use the greater of input width and form width for the maximum autocomplete list width instead of the arbitrary * 2 width.

… to with the bind() function and the initialization function doesn't need to be modified.

Moved the autocomplete window to the form so that the bounding rect is not needed thus avoiding positioning problems e.g. when window is scrolled while suggestions are loading.
Align suggestions when window is resized.
Set the initial content with .html().
Use the greater of input width and form width for the maximum autocomplete list width instead of the arbitrary * 2 width.
@demiankatz
Copy link
Member

Thanks for these -- I'll wait on merging until @crhallberg has a chance to take a look.

Are you still having trouble with clicking entries on a Mac, or has that problem been resolved at this point? (We tried to reproduce the issue over here but could not).

@EreMaijala
Copy link
Contributor Author

Looks like the clicking problem cannot be reproduced anymore, so I suppose another change affected that. I'll let you know if I can reproduce it again.

@demiankatz
Copy link
Member

Thanks!

@crhallberg
Copy link
Contributor

Good catches! I merged these in manually since there was an update to autocomplete.js between this fork and now.

@crhallberg crhallberg closed this Dec 7, 2015
@EreMaijala
Copy link
Contributor Author

@crhallberg, the change that fixed positioning was not merged. Is there a reason for that, e.g. a problem I didn't account for? The current version in vufind-org/master is still not working properly if the position of the input field changes in the viewport while suggestions are loading.

@crhallberg
Copy link
Contributor

@EreMaijala The fixes you proposed were based on a version before I fixed the scrolling problem in general (I wasn't taking scrolling into consideration). When comparing the two methods, I intentionally kept mine for performance reasons (less calls to and searches in the DOM). I just double checked by scrolling all over while loading and typing and the issue is definitely resolved. Thank you again!

@EreMaijala
Copy link
Contributor Author

@crhallberg Your version works with Chrome and Safari but not with Firefox (Mac) or Internet Explorer 9 (Windows 7).

@crhallberg
Copy link
Contributor

I fixed the IE 9 bugs but I cannot produce any Firefox bugs, even on a Mac.

@EreMaijala
Copy link
Contributor Author

@crhallberg Now it works with Firefox and IE 9, but doesn't work with Chrome or Safari anymore.

@EreMaijala
Copy link
Contributor Author

@crhallberg Unless there's a compelling reason to keep the autocomplete results under the body element, please consider again my proposed version. If you had it in the form you wouldn't have to take the scroll position into account at all, and I don't believe having a couple DOM calls here is really a limiting factor.

@crhallberg crhallberg reopened this Dec 10, 2015
@crhallberg
Copy link
Contributor

My apologies. I'm not trying to be stubborn, I thought that putting the autocomplete results into a form would prevent it from moving around the page properly, since multiple inputs use the same results div.

I merged in your changes completely and tested. It all works great. I only upped the min-width to the input width for style preferences.

Sorry again for the long draw on this. I'm merging it in now.

@crhallberg crhallberg merged commit 0d0c316 into vufind-org:master Dec 10, 2015
@EreMaijala
Copy link
Contributor Author

No problem, and thanks for working on it! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants