-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
New ColorPicker submits form #14361
Comments
Thanks for a report! We were clearly doing smoke tests outside of a I'm adding it to our sprint backlog and we'll release the fix in June release. Fixing the issue is one thing but I'd like us to avoid having such issues in the future. Thanks for suggesting linter rule for submits, however we have a good portion of abstraction over the buttons. Precisely speaking, this is the line where the issue is:
I actually find submit type to be a value here (it adds proper semantics). So what we need here is to properly prevent default's |
One way to prevent this is to wrap our manual tests in a |
Until we release a proper fix, you can add the following code in your app: window.setInterval( () => {
Array.from( document.querySelectorAll( '.ck.ck-color-table .ck-color-picker-page-view [type="submit"]') ).forEach( button => {
if ( button.dataset.ckeSubmitWorkaround ) {
return;
}
button.addEventListener( 'click', event => event.preventDefault() );
button.dataset.ckeSubmitWorkaround = true;
} )
}, 300 ); Since it's polling the structure it's not super effective, however there's a simple safeguard to make sure this code is taxing as little as possible. |
Taken over by #14275 . |
There are more buttons that may have the same side effect - e.g. "Save" buttons in table properties and table cell properties. Let's make sure they work as expected too. |
…mits-form Fix (font): The accept button in the color picker will no longer submit forms . Closes #14361.
We faced the same issue related to our form submissions due to the submit button of color picker. |
📝 Provide detailed reproduction steps (if any)
✔️ Expected result
The validation of the color should only update the color defined within ckeditor perimeter.
❌ Actual result
it also submits the form
❓ Possible solution
🩹🩹🩹 A workaround is available until fix is released: #14361 (comment) 🩹🩹🩹
the button being of type="submit" it is expected behavior from HTML.
the switch to a type="button" should correct it.
📃 Other details
It might have sens to add an eslint rule to enforce type="button" on all , since the default type value is submit, but i don't know the whole project.
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: