Opened 6 years ago

Last modified 6 years ago

#9476 confirmed Bug

CKEDITOR.dialog#disableButton not working

Reported by: Jeff Fournier Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0
Keywords: HasPatch Cc:

Description

It is still possible to click on a dialog button after having disabling it with the disableButton method in CKEDITOR.dialog (http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html#disableButton).

When "disableButton" is called, the property "disabled" is correctly set to true and a css class is added to the button. But if you click on the button, there's no check to see if it's disabled and the event is still fired.

I think this could be fixed by modifying the code in _source/plugin/dialogui/plugin.js and adding a check for disabled before the onClick is applied.

Like this :

(line 949)

onClick : function( dialog, func )
{
    this.on( 'click', function()
    {
        if(!this._.disabled)
        {
            // Some browsers (Chrome, IE8, IE7 compat mode) don't move
            // focus to clicked button. Force this.
            this.getElement().focus();
            func.apply( this, arguments );
        }
    });
}

By the way, the css class (cke_disabled) added to the button when it's disabled does nothing and the button doesn't look disabled.

Change History (3)

comment:1 Changed 6 years ago by Jeff Fournier

To reproduce just add this onClick() code to any button in a dialog.

{
  type : 'button',
  id : 'btnTest',
  label : 'test',
  onClick : function() 
  {
    var dialog = this.getDialog();
    dialog.disableButton('ok');
    dialog.disableButton('cancel');
  }
}

comment:2 Changed 6 years ago by Jeff Fournier

Component: UI : DialogsGeneral

comment:3 Changed 6 years ago by Jakub Ś

Keywords: HasPatch added
Status: newconfirmed
Version: 3.6.43.0

It looks like cke_disabled is added but click still works.

Problem can be reproduced from CKEditor 3.0.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy