How do I allow onkeydown to handle events?

“If a canvas widget handles these events, it will receive the keyboard focus when it’s clicked.”

I set dialog canvas onkeydown to a function, but it’s not called.
dialog:canvas{id=“select_canvas”, width=200,autoscaling=true,onkeydown=select_canvas_keydown}

edit2: key presses seem to be handled by aseprite itself and trigger aseprite tools.

edit3: Figured out the problem, I added the canvas to the dialog between two tabs. Putting it after endtabs lets it show up and take key events (but only when it has focus, and it loses focus if a popup happens, like when you print() something).