GithubHelp home page GithubHelp logo

Comments (4)

piranha avatar piranha commented on July 29, 2024

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.

orbitbot avatar orbitbot commented on July 29, 2024

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.

piranha avatar piranha commented on July 29, 2024

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.

piranha avatar piranha commented on July 29, 2024

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)

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.