Comments (4)
Can I ask you what's the usecase for that? Because there is scope (namespacing) support for the case when you want to enable/disable shortcuts in cases like popup is shown or something like that.
Thing is that binding on element receives keys only when focus on an element or any of it's children, which is often not the case. But I'm open for discussion. :)
from keymage.
The idea would be to only capture keypresses when an element is focused, rather than globally. In my usecase, I have implemented a lightweight library for IDE-like behaviour for contenteditable
html tags: https://orbitbot.github.io/misbehave/ , and keymage
should probably be able to handle my needs for that project (with the filed issues fixed) while cutting the unminified size of misbehave
in half.
Instantiation with a target element would enable 1) easier use without needing to bother with global scopes for keymage
, 2) multiple simultaneous instances that do not interfere with each other (such as needing to figure out which element the event was fired on etc.)
from keymage.
Oh, right, with contenteditable it would work this way.
As for figuring it out - you don't usually need that, you just catch focus
on that element and set/unset scope.
But I'll think what's the best way to bind to a concrete element. Don't want to change API much. :)
from keymage.
So yeah, if anybody wants to implement that - I would consider taking a patch, but I see no real need for it.
from keymage.
Related Issues (13)
- Does not fully override browser hotkeys HOT 5
- Make bindings for blessed HOT 1
- Add meta HOT 3
- Disable while text field is focused? HOT 5
- Support attaching to keypress and not only keydown HOT 16
- Can't bind listener for the "Shift" key only HOT 2
- KeyboardEvent.keyCode deprecated HOT 1
- Add a tag HOT 9
- Travis-CI integration HOT 1
- Publish to NPM HOT 12
- Allow to unbind key events HOT 3
- Return prepared unbind()-function from keymage() HOT 2
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 keymage.