Detect ESC in nui

When nui is focused im not able to detect keys like ESC, F1, etc with a keypress listener, is there any other way to detect if ESC is pressed when nui is focused?

Sure you can. In your keyup listener, just check for “Escape” in key attribute of the e event data.

if (e.key === "Escape") {
 // do your thing
}