It takes one line of code to lock the cursor into the screen... You should include that line.
itch.io is an open marketplace for independent game creators. It's completely free to upload your content. Read more about what we're trying to accomplish and the features we provide.