Keystrokes go to terminal even though modal has focus
See original GitHub issueI’m using jquery.terminal 0.8.8 together with bootbox.js. If the terminal has focus when a bootbox prompt modal is shown, the focus is transferred to the text box in the modal as it should, but whatever I type still appears on the terminal instead until I click on the text box. I’ve tried calling disable()
or focus(false)
on the terminal instance before launching the dialog, but nothing seems to happen.
Here is a jsfiddle illustrating the issue: http://jsfiddle.net/0v4ttvfa/2/ (using jquery.terminal 0.7.8 because that’s only version I could find on a CDN). If you click on the “Click me” button, a modal pops up and its text box has focus (pink background), but if you type anything it shows up in the terminal instead. What am I doing wrong?
I looked through old issues and found #89 which seems similar, but I don’t think it’s the same.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top GitHub Comments
There’re two problems. One is that right click don’t triger click event on document. The second is that click event on your context menu item don’t bubble up so terminal can disable itself, when you select menu item.
I can fix it in terminal by adding contextmenu event. Before I do this can run this code:
istead of
$.terminal.active()
you can use your terminal variable. I’ll add same code to terminal.That also works – but I use a few different context menus, so rather than repeat that I put the code in the binding handler so it’ll apply to all context menus.
Thanks again for looking into this!