Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser keypresses such as function buttons are cancelled when term input is paused #1005

Open
ordo-n opened this issue Jan 16, 2025 · 5 comments
Labels

Comments

@ordo-n
Copy link

ordo-n commented Jan 16, 2025

Issue summary

when term.pause(true) f11 doesnt work to go fullscreen, is it just me?

Expected behavior

should not prevent All keypresses

Steps to reproduce

term.pause(true) try f11

Browser and OS

all chrome, edge on windows

@ordo-n ordo-n added the Bug label Jan 16, 2025
@jcubic
Copy link
Owner

jcubic commented Jan 16, 2025

I can reproduce, thanks for the report

@jcubic
Copy link
Owner

jcubic commented Jan 16, 2025

When paused, all key shortcuts are blocked, except CTRL+D that unpause the terminal. Keys are blocked only when terminal is in focus.

You can disable this by using:

$('body').terminal({}, {
   pauseEvents: false,
   keydown() {
     return true;
   }
});

@ordo-n
Copy link
Author

ordo-n commented Jan 16, 2025

When paused, all key shortcuts are blocked, except CTRL+D that unpause the terminal. Keys are blocked only when terminal is in focus.

You can disable this by using:

$('body').terminal({}, {
pauseEvents: false,
keydown() {
return true;
}
});

I tried this code and when the terminal is Not paused some keys like enter, backspace and up and down arrow keys are none responsive

@jcubic
Copy link
Owner

jcubic commented Jan 16, 2025

You're right, didn't check the Cmd plugin, when keydown returns anything non-undefined, the rest of the code is not executed. You need to check if the terminal is paused:

$('body').terminal({}, {
     pauseEvents: false,
     keydown() {
         if (this.paused()) {
             return true;
         }
     }
});

And if you want to allow CTRL+D to unpause and cancel AJAX requests you need:

const term = $('body').terminal({}, {
    pauseEvents: false,
    keydown(e) {
        if (this.paused() && !(e.key === 'D' && e.ctrlKey)) {
            return true;
        }
    }
});

@ordo-n
Copy link
Author

ordo-n commented Jan 16, 2025

That works perfectly. Thanks so much for your help!:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants