Dijit Core Bug: Digits handles click although disable=true

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Dijit Core Bug: Digits handles click although disable=true

Bjoern Burger
Hi,

we found in dojod 1.10.4 a bug in djiit core.
This bug is potentially high risk, because it affects all dijits which have a disabled state.

To simulate the bug (see our code snippet below):
1. Put a dijit/form/Button on a simple html page
2. Use a onClick handler, which:
    a. Set disabled=true
    b. Run javascript code
    c. Set disabled=false
3. First click on button
4. Button is now disabled
5. Click again on this disabled button
6. Check your console > the onClick handler runs twice!

code snippet:
<!DOCTYPE html>
<html>
<head>
    <link href="../../../../../dijit/themes/claro/claro.css" media="screen,print" rel="stylesheet" type="text/css">

    <style>
        .dijitButtonDisabled .dijitButtonNode{
            background-color: grey;
        }
    </style>

    <script type="text/javascript"
            src="../../../../../dojo/dojo.js"
            data-dojo-config="basePath:'../../../../../', async: true, tlmSiblingOfDojo: 0, isDebug: 0, packages: [
    { name: 'dojo', location: '../dojo' },
    { name: 'dijit', location: '../dijit' }
    ]">
    </script>

    <script type="text/javascript">
        require(["dojo/parser", "dojo/dom", "dijit/form/Button"], function (dojoParser, dom) {
            dojoParser.parse({
                rootNode: dom.byId("wrapperDiv")
            });
        });

        function clickHandler(){
            require(["dijit/registry"], function(reg){
                reg.byId("buttonUnderTest").set("disabled", true); // Let's disable the Button until the Asyc-Request is finished
                setTimeout(function (){ //Let's simulate an Async-Request
                    var j = 0;
                    console.log("Start of heavy Javascript Interaction");
                    for(var i = 0; i < 2000000000; i++){ //Small note: Depending on machine/browser you need to make the loop bigger/smaller
                        j++;
                        //Simulation of some heavy JavaScript-Interaction
                        //This is not needed for reproducing the bug,
                        //but without it the timeframe is too small to hit!
                    }
                    console.log("End of heavy Javascript Interaction");
                    reg.byId("buttonUnderTest").set("disabled", false); //We enable the Button again, so that the User can click again!
                }, 0)
            });
        }

    </script>
</head>
<body>
    <div id="wrapperDiv">
        <button data-dojo-type="dijit/form/Button"
                id="buttonUnderTest"
                type="button" onClick="clickHandler()">
            Click me twice to see the bug!
        </button>
        <br>
        <span>
            After clicking the Button twice you will notice, that both of the console-logs will be shown twice.
            The Click-Handler has run 2 times.</span>
    </div>
</body>
</html>

I´d appreciate if you could open a ticket for this bug and let us know the ticket number.
 
Thanks a lot in advance.


Kind regards,
Bjoern

http://www.datev.de | http://www.datev.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dijit Core Bug: Digits handles click although disable=true

dylanks
Hi Bjoern,

Could you please verify this is still an issue with 1.10.8, or a 1.11.x
or 1.12.x release? While I assume it's still an issue, you should verify
against the latest patch releases rather than releases from a couple of
years ago in case the issue has already been addressed. Thanks!

Regards,
-Dylan

on 4/12/17, 07:12 (GMT-07:00) Bjoern Burger said the following:

> Hi,
>
> we found in dojod 1.10.4 a bug in djiit core.
> This bug is potentially high risk, because it affects all dijits which have
> a disabled state.
>
> To simulate the bug (see our code snippet below):
> 1. Put a dijit/form/Button on a simple html page
> 2. Use a onClick handler, which:
>     a. Set disabled=true
>     b. Run javascript code
>     c. Set disabled=false
> 3. First click on button
> 4. Button is now disabled
> 5. Click again on this disabled button
> 6. Check your console > the onClick handler runs twice!
>
> code snippet:
>
>
> I´d appreciate if you could open a ticket for this bug and let us know the
> ticket number.
>  
> Thanks a lot in advance.
>
>
> Kind regards,
> Bjoern
>
> http://www.datev.de | http://www.datev.com
>
>
>
> --
> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dijit-Core-Bug-Digits-handles-click-although-disable-true-tp4007240.html
> Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dijit Core Bug: Digits handles click although disable=true

Bjoern Burger
This post was updated on .
Hi Dylan,

thanks for your fast response!

We tested with version 1.12.2 and the problem still occurs.

Our sample on jsfiddle: http://jsfiddle.net/aspj1ta7/1/


Kind regards,
Bjoern

http://www.datev.de | http://www.datev.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dijit Core Bug: Digits handles click although disable=true

dylanks
Ok, I've created https://bugs.dojotoolkit.org/ticket/19001 . Your code
example did not make it into the original email, so please either add it
to the ticket or send it to me via email.

Regards,
-Dylan

on 4/13/17, 06:50 (GMT-07:00) Bjoern Burger said the following:

> Hi Dylan,
>
> thanks for your fast response!
>
> We tested with version 1.12.2 and the problem still occurs.
>
> Kind regards,
> Bjoern
>
> http://www.datev.de | http://www.datev.com
>
>
>
> --
> View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dijit-Core-Bug-Digits-handles-click-although-disable-true-tp4007240p4007246.html
> Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Co-Founder, Dojo Toolkit
CEO, SitePen, Inc.  http://www.sitepen.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Dijit Core Bug: Digits handles click although disable=true

Bjoern Burger
I added the link to the code example on jsfiddle to the ticket.

Regards,
Bjoern

http://www.datev.de | http://www.datev.com
Loading...