Is there a way to keep a element focused?

There is a in my plugin, and I want it to keep its focus regardless of user interacting with PS(e.g. drawing a line manually)

Is there a workaround which makes this work? Or Is there a way to force a element “focus” in my plugin via keyboard ?