Giter Club home page Giter Club logo

Comments (5)

niketpathak avatar niketpathak commented on June 9, 2024 1

Hello, thank you for reporting this bug. It has been fixed in v4.11.0.

Also to access the source maps, use a specific version in your script tag, for example =>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/typeahead-standalone.js">
The will ensure that the source-maps load correctly (https://cdn.jsdelivr.net/npm/[email protected]/dist/typeahead-standalone.js.map)

Thanks again!

from typeahead-standalone.

speich avatar speich commented on June 9, 2024 1

I think you can handle pretty much all use cases with the config callback property display:

display: (selectedItem, evt) => {
    if (evt && evt.type === 'click') {
      // submit form here
    }
    // if tab should not replace the input value with item.property
    return (evt && evt.key === 'Tab') ? evt.target.value : item.property;
}

from typeahead-standalone.

webVerts avatar webVerts commented on June 9, 2024

also i get an following error
DevTools failed to load source map: Could not load content for https://cdn.jsdelivr.net/npm/typeahead-standalone.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

from typeahead-standalone.

webVerts avatar webVerts commented on June 9, 2024

Hey @niketpathak the issue still persists for me when preventSubmit: false .

I might be wrong here, but according to my understanding, if I click on the username it should trigger the onSubmit function. With the keys it triggers as intended, but on using mouse click, it fills in the data in the form, but I don't receive data on my console log. I've updated the code https://codepen.io/webVerts/pen/vYjNEGm

from typeahead-standalone.

niketpathak avatar niketpathak commented on June 9, 2024

Hey @webVerts ,

This is intended behavior. When you select a suggestion via your Keyboard(Arrow keys) and press the Tab key,
the behavior is similar to what would happen when you click on a suggestion. This is because you are only selecting a suggestion, but not submitting it, hence the onSubmit callback is not executed.

The onSubmit callback is used to submit data when the input element is used outside of a form. It therefore gets executed only when you hit the Enter key. For example, when you select a suggestion by clicking on it, the input element will be filled with the necessary text. And then when you hit Enter, the onSubmit callback will be executed.

I think what you are looking for is an onSelect callback which does not exist yet. If you could kindly elaborate on the use-case of why this callback would be useful/necessary, we will definitely include it in the next release. Thanks!

from typeahead-standalone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.