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

Submitting form with typeahead inside #165

Closed
mic4ael opened this Issue Mar 11, 2016 · 7 comments

Comments

Projects
None yet
3 participants
@mic4ael

mic4ael commented Mar 11, 2016

Together with my teammates today we stumbled upon an error in one of our custom jQuery widgets which uses the typeahead library internally. The problem was caused by calling hideLayout when submitting a form. After some investigations we found the lines which are the main culprit.
Link to the source code

// Means the container is already hidden
// if (!this.container.hasClass('result')) return;

It kind of makes sense to check if layout is already shown and if there is a necessity to hide it, thus my question is if this comment is intended? If it is, then, can we get exaplanation why?

@ThiefMaster

This comment has been minimized.

ThiefMaster commented Mar 11, 2016

Did you post markdown with a broken URL or did you stumble on a GitHub bug? Your link points to https://github.com/running-coder/jquery-typeahead/issues/url

@mic4ael

This comment has been minimized.

mic4ael commented Mar 11, 2016

Sorry for the mistake. The url has been corrected.

@running-coder

This comment has been minimized.

Owner

running-coder commented Mar 12, 2016

Hey mic4ael,
I've commented this line to implement a backdrop/fullpage search option recently. This ticket and investigation made me realize that show/hide layout is not handled properly. The functions are indeed not fired at the proper time depending on the used configuration.

So you get a better understanding of the backdrop search: http://jsfiddle.net/runningcoder/xd0q4co1/

@running-coder

This comment has been minimized.

Owner

running-coder commented Mar 12, 2016

I've uncommented the code and fixed the backdrop option so it behaves properly with "Esc" key so hideLayout doesn't always gets through

@mic4ael

This comment has been minimized.

mic4ael commented Mar 12, 2016

That is great. Thanks for your professionalism and quick response.

@running-coder

This comment has been minimized.

Owner

running-coder commented Mar 12, 2016

Thanks for raising the issue! let me know if everything works as expected

@mic4ael

This comment has been minimized.

mic4ael commented Mar 15, 2016

It looks like the fix solves the issue for us.

@mic4ael mic4ael closed this Mar 15, 2016

running-coder added a commit that referenced this issue Mar 26, 2016

Version 2.4.0
Features
- #160 if onSubmit callback returns true, the form should be submitted with a regular browser submit
Fixes
- #166 Different browsers do not have the same behaviors when pressing "Esc" key when the input is focused
- #165 Submitting form with typeahead inside (hideLayout called multiple times)
- #161 Fixed missing X icon when using bootstrap css
Notes
- #170 jquery-typeahead as a npm package
- #169 Add basic unit tests
- Abandonned Dynamic Source Switching option. Would have to handle too many custom case, instead the sources should be loaded and a matcher function should be used

running-coder added a commit that referenced this issue Mar 26, 2016

Version 2.4.0
Features
- #160 if onSubmit callback returns true, the form should be submitted with a regular browser submit
Fixes
- #166 Different browsers do not have the same behaviors when pressing "Esc" key when the input is focused
- #165 Submitting form with typeahead inside (hideLayout called multiple times)
- #161 Fixed missing X icon when using bootstrap css
Notes
- #170 jquery-typeahead as a npm package
- #169 Add basic unit tests
- #148 Updated Typeahead AMD, please review requirejs_v1 example
- Abandonned Dynamic Source Switching option. Would have to handle too many custom case, instead the sources should be loaded and a matcher function should be used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment