Giter VIP home page Giter VIP logo

Comments (6)

jez500 avatar jez500 commented on July 29, 2024

Hows this for a solution...
While the search box has focus, detecting if CTRL/CMD (or ALT) is depressed and ignore it and any other key presses while it is. Unless anyone can think of a more elegant solution?

from chorus.

kopf avatar kopf commented on July 29, 2024

Would it not work to simply use something like jquery's .change() ? http://api.jquery.com/change/

Or is that what's already being used, and it's buggy? :)

from chorus.

jez500 avatar jez500 commented on July 29, 2024

Using keyup() I think, so change() might actually solve it! Good call.
There is some other logic wrapped around it too, ie. a timeout so it doesn't try to search for about a second after typing has stopped, but that should still work with change()

from chorus.

kopf avatar kopf commented on July 29, 2024

Although, I just noticed this after posting my comment:

or select boxes, checkboxes, and radio buttons, the event is fired immediately when the user makes a selection with the mouse, but for the other element types the event is deferred until the element loses focus.

So, i guess this is why keyup() is used instead of change. Ugh.

I guess we could do something like fire on keyup, and the function that's fired checks for a change in the value of the dom element. Already getting very complicated, though.

An alternative is to use .on('input'), which is apparently only available on "modern browsers" (but that's already a requirement for chorus). Here's an example - http://jsfiddle.net/K682b/6/ . I tested it, and the event fires on changes, but not on pressing the modifier keys, so it seems perfect..

from chorus.

jez500 avatar jez500 commented on July 29, 2024

Yeah just tested it and change() is a no-go.
.on('input') looks like a winner. And yes, there is no good reason someone should be running an old browser these days :)
I'll do some more testing but if all good, I think we have our solution!

from chorus.

jez500 avatar jez500 commented on July 29, 2024

Updated in 0.3.9, tested well for me, re-open if any issues

from chorus.

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.