Disable keyboard shortcuts in input field

Hi,

I have a NodeType that contains an input search field. I want the editors to be able to use the search field in the Neos backend.

Problem is: When I enter certain strings, the Neos backend keyboard shortcuts are triggered. For example: If I try to enter the word time the inspector opens or closes because of the keyboard shortcut ti (toggle inspector).

Is there a way to disable the keyboard shortcuts via Javascript (i.e. using the focus/blur events)?
Or if it is complicated: Can I somehow disable the keyboard shortcuts alltogether?

Regards
Leif

1 Like

After digging through the Neos UI code, I think it is not (or alteast not easily) possible to deacitvate the hotkeys in the guest frame.

I think the whole hotkey pausing happens here: https://github.com/neos/neos-ui/blob/8.3/packages/neos-ui-sagas/src/UI/Hotkeys/index.js

But it only happens when inline editing starts. If someone else has an idea how to pause Mousetrap when entering an input field of the guest frame I am all ears.

In the meantime I helped myself with a dirty little workaround:

If in Backend:

['keydown', 'keyup', 'keypress'].forEach(eventName => {
    input.addEventListener(eventName, (e) => {
        e.stopPropagation();
    });
});

It is not pretty, but it works for my case.

I see that as a valid solution. The input event thing in the guest frame is tricky and active input fields are a bit unusual usecase.
But please create an issue for this in the Neos.UI GitHub repo if there isn’t one.