Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

prompt() cancel button does not work #9

Closed
simonw opened this issue Dec 7, 2024 · 2 comments
Closed

prompt() cancel button does not work #9

simonw opened this issue Dec 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@simonw
Copy link
Owner

simonw commented Dec 7, 2024

If you click cancel after entering text it behaves the same as if you had clicked OK:

CleanShot 2024-12-07 at 14 42 39@2x

@simonw simonw added the bug Something isn't working label Dec 7, 2024
@simonw
Copy link
Owner Author

simonw commented Dec 7, 2024

I tried a few more rounds with Claude but it didn't manage to fix the bug: https://gist.github.com/simonw/590ddbb627424127e0d3d76e597d71d6

End result here - note that clicking "Cancel" still does the wrong thing: https://static.simonwillison.net/static/2024/claude-bug-prompts/prompts-js.html

I may have to fix this by hand!

@simonw
Copy link
Owner Author

simonw commented Dec 8, 2024

Here's the cause of the bug:

prompts-js/index.js

Lines 157 to 162 in cecf4a8

// Handle form submission
form.addEventListener("submit", (e) => {
e.preventDefault();
dialog.returnValue = "ok";
dialog.close();
});

@simonw simonw closed this as completed in dea3c12 Dec 8, 2024
simonw added a commit that referenced this issue Dec 8, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant