Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My biggest issue is wanting to bind ctrl/meta-x/c/v to do what you think they would do in my UI (a graph editor), but not do anything in input fields. I can stopPropagation, but it is a pain to keep track of.


You can attach an event to the window or some other higher-level element and check if event.target is an input field... something along the lines of:

    document.body.addEventListener('keydown', function(e) {
      if (e.target.tagName !== 'INPUT') doKeyBindings();
    }, false);




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: