How does keyboard input work?

In 3D WebView, keyboard input can be sent to a webview through the following methods:

For example, 3D WebView's demo scenes (like SimpleWebViewDemo.cs) set up the Keyboard prefab to send its output to HandleKeyboardInput(), like this:

// Hook up the on-screen keyboard.
var keyboard = GameObject.FindObjectOfType<Keyboard>();
keyboard.InputReceived += (sender, eventArgs) => {
    webViewPrefab.WebView.HandleKeyboardInput(eventArgs.Value);
};

Similarly, the demo scenes use a helper class named HardwareKeyboardListener to detect input from the hardware keyboard and send it to HandleKeyboardInput, like this:

var hardwareKeyboardListener = HardwareKeyboardListener.Instantiate();
hardwareKeyboardListener.KeyDownReceived += (sender, eventArgs) => {
    webViewPrefab.WebView.HandleKeyboardInput(eventArgs.Value);
};