2

I am using the JCubic Jquery Terminal, works great but the cursor is always focused on the terminal cmd.

Any other textfield/textbox on the page does not work because any key press focuses the cursor back on the Terminal.

https://github.com/jcubic/jquery.terminal/tree/master/js

I assume there's an answer in the jquery.terminal-1.3.1.js file. But where?

Thanks :)

FrozenSnow
  • 31
  • 6
  • possible solutions involve `onBlur`, `keydown`, `keypress` handlers in your `options` you pass when you create the terminal - there could be others, there's a **LOT** of [options in the DOCUMENTATION](http://terminal.jcubic.pl/api_reference.php) – Jaromanda X May 09 '17 at 04:56
  • 1
    Do you use `onBlur: fuction() { return false; }` like in demos that are full screen? This prevent loosing focus. – jcubic May 09 '17 at 07:17
  • do you have a demo online? – jcubic May 09 '17 at 14:11
  • Hey! Glad to see the project is so active. I can definitely make a demo, how can I message you the login details? also, it shows "onBlur: e.noop" – FrozenSnow May 09 '17 at 18:14
  • I fixed it by changing any onBlur from false to true. not sure if that's the smartest way though!! – FrozenSnow May 09 '17 at 18:21
  • Hey guys, I have been facing the same issue . Could you elaborate on how you fixed it? – Reuben_v1 May 31 '17 at 09:25

1 Answers1

0

I worked around that by returning from keypress and keydown handlers when target is an input:

return $(this.context).terminal( () => {}, {
    keypress        : (e, terminal) => {
        if (e.target.tagName.toLowerCase() === 'input') {
                return true;
        }
        // ...
    },

    keydown         : (evt, terminal) => {
        if (evt.target.tagName.toLowerCase() === 'input') {
                return true;
        }
        // ...
    }
    // ...
});

Klesun
  • 12,280
  • 5
  • 59
  • 52