diff --git a/CHANGES.md b/CHANGES.md index 41355e9e655..aae2c99d910 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ New Features: Fixed Issues: +* [#12465](http://dev.ckeditor.com/ticket/12465): Fixed: Can't change state of checkboxes/radio buttons if the properties dialog was invoked via double-click. * [#13062](http://dev.ckeditor.com/ticket/13062): Fixed: Impossible to unlink when the caret is at the edge of the link. * [#13585](http://dev.ckeditor.com/ticket/13585): Fixed: Error when wrapping two adjacent `
`s with a `
`. * [#16866](http://dev.ckeditor.com/ticket/16866): [IE, Edge] Fixed: Whitespaces not preserved when pasting from Word. diff --git a/plugins/forms/dialogs/checkbox.js b/plugins/forms/dialogs/checkbox.js index 3a27774148f..121a2327e59 100644 --- a/plugins/forms/dialogs/checkbox.js +++ b/plugins/forms/dialogs/checkbox.js @@ -116,10 +116,17 @@ CKEDITOR.dialog.add( 'checkbox', function( editor ) { } } else { var value = this.getValue(); - if ( value ) + // Blink/Webkit needs to change checked property, not attribute. (#12465) + if ( CKEDITOR.env.webkit ) { + element.$.checked = value; + } + + if ( value ) { element.setAttribute( 'checked', 'checked' ); - else + } + else { element.removeAttribute( 'checked' ); + } } } }, diff --git a/plugins/forms/dialogs/radio.js b/plugins/forms/dialogs/radio.js index 1508fea1674..7f8ea1ea7ba 100644 --- a/plugins/forms/dialogs/radio.js +++ b/plugins/forms/dialogs/radio.js @@ -2,6 +2,7 @@ * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or http://ckeditor.com/license */ + CKEDITOR.dialog.add( 'radio', function( editor ) { return { title: editor.lang.forms.checkboxAndRadio.radioTitle, @@ -87,7 +88,13 @@ CKEDITOR.dialog.add( 'radio', function( editor ) { var element = data.element; if ( !CKEDITOR.env.ie ) { - if ( this.getValue() ) + var value = this.getValue(); + // Blink/Webkit needs to change checked property, not attribute. (#12465) + if ( CKEDITOR.env.webkit ) { + element.$.checked = value; + } + + if ( value ) element.setAttribute( 'checked', 'checked' ); else element.removeAttribute( 'checked' ); diff --git a/tests/plugins/forms/manual/checkboxradiochangestate.html b/tests/plugins/forms/manual/checkboxradiochangestate.html new file mode 100644 index 00000000000..b005b36f48e --- /dev/null +++ b/tests/plugins/forms/manual/checkboxradiochangestate.html @@ -0,0 +1,13 @@ + +
+

Example text

+
+ + + diff --git a/tests/plugins/forms/manual/checkboxradiochangestate.md b/tests/plugins/forms/manual/checkboxradiochangestate.md new file mode 100644 index 00000000000..f03ee20213f --- /dev/null +++ b/tests/plugins/forms/manual/checkboxradiochangestate.md @@ -0,0 +1,21 @@ +@bender-tags: tc, 4.7.0, 12465, forms +@bender-ui: collapsed +@bender-ckeditor-plugins: forms, wysiwygarea, toolbar + +---- + +1. Click in the editor. +2. Click "Checkbox" button. +3. Check "Selected" field in the dialog and press "Ok" to create a checkbox. +4. Double click the checkbox. +5. Check "Selected" field in the dialog and press "Ok" to modify the checkbox. + +**Expected:** +* The state of checkbox is changed. + +---- + +Repeat the same operation with "Radio Button" button. + +**Expected:** +* The state of radio button is changed.