-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating tree mode value on enter key submits form #498
Comments
Thanks for bringing this up. Apparently the form also sees pressing Enter in an editable div as a submit event, also can't find any documentation about that on MDN 🤔. I think we can fix that by adding a As a workaround: you can add a document.querySelector('form').addEventListener('submit', (event) => {
event.preventDefault()
}) Though I'm not sure how to detect whether the submit originated inside the JSON editor or an other form element. |
I think I'll be able to push a fix this afternoon. |
Fixed now in |
Thank you for the fix! I've tested the v2.0.1 release and it resolves the issue. |
I'm using the original jsoneditor library exclusively within forms. I've been working on an upgrade to use this new library within those same forms and it has gone well. I'm enjoying the new version, thank you!
As reported in #274 which is now closed, I'm noticing the same issue with the tree mode. I'm creating a new issue since this is a bug and should be addressed but a reproduction was requested. The issue is easy to simulate.
Inputting the following in the HTML field of a new codepen reproduces the problem when editing the value in tree mode and hitting the enter key. It will submit the form and load the codepen.io home page.
Can this issue be fixed so editing in tree mode won't submit a form when its not desired or expected?
Is there a way to possibly intercept and disable that behavior on my side at least temporarily?
Another option I couldn't figure out in the docs, is it possible to disable the tree mode?
The text was updated successfully, but these errors were encountered: