﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
12568	"Docprops dialog color ""choose"" buttons behave strangely if colorpicker dialog is cancelled"	jhub		"This is the same as #8771 which was closed as ""expired - can't reproduce"" a while back. This bug is still present in 4.4.5 and is actually very easy to reproduce even with the demo at [http://ckeditor.com/demo#full-page]:

Click the document properties button to open the docprops dialog.

Go to ""Design"" page.

Click on ""Choose"" button of ""Text color"" field.

Do *not* pick a color in the colorpicker but close the colorpicker with ""Cancel"".

Click on ""Choose"" button of Background color"".

Now *do* pick a color in the colorpicker and close it with ""OK"":


The selected color is set into the ""Background color"" field (as expected) but is incorrectly *also* set into the ""text color"" field.

As already described in #8771, the problem is in ckeditor/plguins/docprops/dialogs/docprops.js, in the ""getDialogValue"" function:

Buggy code:
{{{
var onOk = function() {
	releaseHandlers( this );
	callback( this, this._.parentDialog );
};
var releaseHandlers = function( dialog ) {
	dialog.removeListener( 'ok', onOk );
	dialog.removeListener( 'cancel', releaseHandlers );
};
var bindToDialog = function( dialog ) {
	dialog.on( 'ok', onOk );
	dialog.on( 'cancel', releaseHandlers );
};
}}}

The problem with the above is that ""releaseHandlers"" is set directly as the ""cancel"" listener.

Suggested change:
{{{
var onOk = function() {
	releaseHandlers( this );
	callback( this, this._.parentDialog );
};
var onCancel = function() {
	releaseHandlers( this );
};
var releaseHandlers = function( dialog ) {
	dialog.removeListener( 'ok', onOk );
	dialog.removeListener( 'cancel', onCancel );
};
var bindToDialog = function( dialog ) {
	dialog.on( 'ok', onOk );
	dialog.on( 'cancel', onCancel );
};
}}}"	Bug	confirmed	Normal		General	3.6			
