How to configure Session Event Key Event


I am trying to configure a Session Events , Key Event .
My script is very simple and i used it in a button and it work :

The goal is to have a barcode scanner that will read a barcode then the page will change open to other idea then the Session Event.

I configured Keydown and then did many test like : F1, spacebar, Code,.
I also tried the option : Capture Phase and Prevent Default.

Thank You

Your one line needs to be indented the same depth as the comment above it.

It work very well with event.key but i cant get to make it work with event.code is the something different when that happen.