This repo has a sample HTML page that shows a canvas and allows a user to click on the canvas which will show a textbox they can type into. They can then hit Enter and the textbox will put the text where the user clicked. They can also hit Escape while in the text box to cancel the action.
You can also visit this REPL to see this demo in action: https://replit.com/@heyitsmarcus/Simple-Canvas-with-Input
Anyone may use this freely as part of any project! :)