Comments (4)
@dalf Are you sure that the form is really sent because if I see the last released source code, I can see a preventDefault
call.
- https://github.com/autocompletejs/autocomplete.js/blob/v2.4.0/src/autocomplete.ts#L155
- https://github.com/autocompletejs/autocomplete.js/blob/v2.4.0/src/autocomplete.ts#L170
I can't reproduce the same fail. Do you have others informations to reproduce the issue ?
from autocomplete.js.
I have the same issue with HTML5 forms with validation constraints. Reproducable on current versions of Microsoft Edge, Mozilla Firefox and Google Chrome browsers. Safari was not tested.
AutoComplete( { ... }, 'input[name="zipcode"]' );
No special options where set. Just a url for the request and a limit. When iterating through the results with the up and down keys and then pressing enter, to select an item, the form triggers the invalid event. If all elements are valid the form submits. The _Select method is not executed.
After a deep dive into the code I found out, that the default keyboard mapping KeyUpAndDown_down ist triggered before Enter. So Enter never gets fired, because the key code 13 is not set in the conditions of KeyUpAndDown_down.
A small hotfix for this issue to get it working correctly.
var mapping = Object.assign(AutoComplete.defaults.KeyboardMappings, {
'KeyUpAndDown_down' : {
Conditions : [
{
Is : 38,
Not : false
},
{
Is : 40,
Not : false
},
{
Is : 13,
Not : false
}
],
Callback : function(event) {
event.preventDefault();
},
Operator : 1,
Event : 0
}
});
AutoComplete(
{
KeyboardMappings : mapping
},
'input[name="zipcode"]'
);
Now you can iterate through the results with the up and down keys and select an item with enter.
from autocomplete.js.
I've just made a quick example : https://github.com/dalf/autocomple-test
from autocomplete.js.
This issue has been resolve into 2.6.3
. Sorry for the response time !
from autocomplete.js.
Related Issues (20)
- How can I unbind the input? HOT 1
- How to work with different data model HOT 1
- query argument customizing HOT 1
- When item is selected input remains empty HOT 3
- cannot find AutoComplete() HOT 1
- display changes to ID value... HOT 1
- [Deprecation] Using unescaped '#' HOT 1
- Access to request events?
- Multiple Autocompletes use same cache HOT 2
- default _Blur always has now == true
- Click is not registered if holding mouse key for too long
- How to use directly without NPM? HOT 2
- tab & esc conditions
- Using raw html in response leaves suggestion flyout empty
- TypeError: mapping.Conditions is undefined
- The autocomplete is showing all the elements instead of showing only the query.
- Backspace query string under _MinChars fires request
- Programmatically changing text field value / Dropdown won't open if field is preloaded with value.
- How to Override Method HOT 1
- Project maintenance status: abandoned?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from autocomplete.js.