V
V
Vasya Lee2020-10-14 15:35:00
Browser extensions
Vasya Lee, 2020-10-14 15:35:00

What are the event types rawKeyDown, char?

Hello. I haven't done extension development before, but it became necessary to implement user input imitation, which led me to extensions. The question is the following:
When triggering keyboard events (Input.dispatchKeyEvent), there are 4 types of event keyDown, keyUp, rawKeyDown, char. The first two types of events are clear, but about the rest I can not find anything absolutely and nowhere. Other than this page https://chromium.googlesource.com/chromium/blink/+...
Here is the most important part :

switch (type) {
        case PlatformEvent::KeyUp:
            return EventTypeNames::keyup;
        case PlatformEvent::RawKeyDown:
            return EventTypeNames::keydown;
        case PlatformEvent::Char:
            return EventTypeNames::keypress;
        case PlatformEvent::KeyDown:
            // The caller should disambiguate the combined event into RawKeyDown or Char events.
            break;
        default:
            break;
    }

Here I am the internal implementation of these methods or what? Please give a link where you can read about the types of keyboard events. And why is it so difficult to find any information on them?
And one more question. Why doesn't Input.dispatchKeyEvent with type keyDown throw a character into the text field? The event occurs, istrusted =true, the required input is found successfully, but there is no input to this input.
But if the keyDown type is changed to char , then the desired character is entered normally.
In general, a lot of questions, and I could not find answers on my own. Even in the documentation.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
acwartz, 2020-11-04
@acwartz

The correct answer is to read the source codes of Google. chrome, if you really want to find some kind of flaw.
What you are asking about is a cross-platform wrapper over the event models of various operating systems, which is why it is called PlatformEvent. raw I suppose the event of pressing a non-character key, such as cmd / ctrl / enter, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question