question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Overriding hotKeys in keyboard module?

See original GitHub issue

What is the recommended way for overriding predefined hotkeys? Tab for example…it appears the callback passed to addHotkey gets executed in tandem with any that have already been defined.

My particular use case being tab-completion, ie if a suggested item is available, tab should select that item, otherwise proceed with the predefined behavior.

Maybe callbacks defined with addHotkey get executed first and if any return false then the chain stops? Something like that?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
julianlamcommented, Aug 14, 2018

@unhammer For what it’s worth, your trick works quite well to override a default binding without actually removing the default behaviour completely. My use case was exactly the same as yours, I wanted to integrate a textcomplete dropdown.

var doAutocomplete = function () {
    return !textcompleteDropdownIsOpen();
};
[9, 13].forEach(function (keyCode) {
    quill.keyboard.addBinding({
        key: keyCode,
    }, doAutocomplete);
    quill.keyboard.bindings[keyCode].unshift(quill.keyboard.bindings[keyCode].pop());
});

So as of late 2018, this still works 😄

0reactions
yesyvescommented, Feb 7, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

DocumentEditor / How To / Override keyboard shortcuts
Override or define a new keyboard shortcut behavior instead of preventing the keyboard shortcut. For example, Ctrl + S keyboard shortcut saves the...
Read more >
Overriding Hotkeys
Overriding or Disabling Hotkeys. You can disable all built-in Windows hotkeys except Win+L and Win+U by making the following change to the registry...
Read more >
How can I override default "global" keyboard shortcuts and ...
I understand that I'm going to be "overriding" the default behavior of some controls (e.g. Page-Up / Page-Down in a text box will...
Read more >
How to Make Hotkeys in Python
We will be using the pynput module to listen to mouse events. ... from pynput.keyboard import HotKey, Key, KeyCode, Listener # The function ......
Read more >
012 Keyboard shortcut override toggle - YouTube
www.scott.training | 3ds Max and VIZ for Architects (2007) | Module 1: Starting | Customizing the UI | Keyboard shortcut override toggle.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found