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

Miew will disabled s/+/- keys on pages where it's initialized #534

Open
themoenen opened this issue Mar 27, 2024 · 1 comment
Open

Miew will disabled s/+/- keys on pages where it's initialized #534

themoenen opened this issue Mar 27, 2024 · 1 comment
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@themoenen
Copy link

Describe the bug
The s key as well as the numeric keyboard's + / - keys are disabled when you try to type on a page where Miew is initialized.

To Reproduce

  • Initiate Miew with default settings
  • Try typing in an input field on the same page as the Miew viewer

Expected behavior
s key should type 's' character.

Additional context
Responsible code:

Miew.prototype._onKeyDown = function (event) {
    [...]
    switch (event.keyCode) {
    case 'S'.charCodeAt(0):
        event.preventDefault();
        event.stopPropagation();
        settings.set('ao', !settings.now.ao);
        this._needRender = true;
        break;
    [...]
}

In the change log there's a mention of when and why this was implemented:

## [0.7.4] - 2017-10-16
- Prevent 's' key from appearing in the terminal when it is closed.
@themoenen themoenen added the bug Indicates an unexpected problem or unintended behavior label Mar 27, 2024
@themoenen themoenen mentioned this issue Mar 27, 2024
5 tasks
@paulsmirnov
Copy link
Member

Thank you. As we discussed previously in #524, eating keypresses is indeed a bold behavior for the library. However, does this particular description of the issue make it a bug? I mean, why not just switch it off on your page with miew.enableHotKeys(false) that exists specifically for the case you described? The demo application at https://miew.app/ perfectly allows typing all characters into the integrated terminal 🙂

Please give us some time to review the PR. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants