Keyboard events are sent to focusable elements that are in focus.
A vanilla VisualElement
is not focusable by default but can made so by setting VisualElement.focusable
to true
.
To make them focused, the user has to click into it or tab to give it focus.
You can force the focus when the element is ready: