Comments (6)
So the problem you are seeing is that when a user has selected a text field, you are calling stop_listening() on your listener, but when you type into the text field, your combos are being activated? Perhaps you are also immediately calling start_listening() as well. Do you have a code sample to demonstrate this issue?
from keypress.
HI David,
$(document).ready(function() {
var listener = new window.keypress.Listener();
listener.sequence_combo("shift g o", function() {
window.location.href = "app/view-orders";
});
$('input').bind("focus", listener.stop_listening)
.bind("blur", listener.listen);
});
from keypress.
Whenever I place a console.log event in the stop_listening part of the code, I can see it's being fired but the actual listener event doesn't seem to stop.
from keypress.
It's better to use
$('input').focus(function(){console.log("got focus")});
now
Replacement for .bind("blur") is just blur(func)
from keypress.
The problem with your code sample is that you're calling stop_listening as if it were a function instead of a method. The value of this
in that method is important. Try this:
$(input).bind("blur", function() { listener.stop_listening(); });
That should do it.
from keypress.
Just realized I made this mistake in my documentation :0
Sorry about that. Fixed: #80
from keypress.
Related Issues (20)
- Support for mobile
- Published node-package 2.1.4 is broke HOT 1
- how to make a key pressed and won't interrupt by other keys before it keyup ? HOT 1
- bug: meta combos are not being unregistered HOT 3
- jQuery integration HOT 1
- calling "register_combo" with Typescript needs to initialize all the parameters HOT 2
- simple_combo('r') fires even with modifier keys. HOT 1
- basic key binding not working as expected
- TypeError: window.keypress is undefined HOT 3
- `simple_combo` doesn't work in a bootstrap modal
- Using with Meteor [ TypeError: Keypress.Listener is not a constructor ] HOT 3
- Delay HOT 3
- location support?
- how to distinguish inputs from multiple keyboards? HOT 1
- ALT CTRL 1 works, but ALT 1 and CTRL 1 do not. HOT 5
- Blocked by EasyPrivacy HOT 1
- keycodes HOT 1
- Providing an "on_keydown" handler shouldn't stop the key from working inside inputs.
- Select all keyboard keys HOT 3
- Untrimmed key combination string silently causes issues HOT 1
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 keypress.