Opened 5 years ago

Closed 4 years ago

#17578 closed defect (duplicate)

When using dojo touch with dojoClick == true, a lengthy operation in a click handler result in two click events

Reported by: Sebastien Brunot Owned by: Sebastien Brunot
Priority: undecided Milestone: tbd
Component: DojoX Mobile Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

See the attached example: dojoClick is set to true on the document body, and both the button and the DIV have a handler for onClick events that perform an operation that takes a long time.

When the button or the DIV is clicked on a mobile device (tested on ipad mini iOS 6), the handler is executed twice:

1) first on the synthetic click event 2) second on the native click

This occurs because the test "new Date()).getTime() <= clickTime + 1000" is false when the native event is processed by the top level handler defined in the stopNativeEvents method.

Attachments (1)

dojoClick.html (1.2 KB) - added by Sebastien Brunot 5 years ago.
Example that reproduce the issue on a mobile device.

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by Sebastien Brunot

Attachment: dojoClick.html added

Example that reproduce the issue on a mobile device.

comment:1 Changed 5 years ago by bill

Wow, a click handler that locks the display for >1s is badly designed, but did you have a simple fix in mind?

comment:2 Changed 5 years ago by Sebastien Brunot

No, I'm affraid I don't have a simple fix in mind.

If this is mainly a problem of bad design of the click handler, maybe we can come up with a good design practice that would ensure that no handler would run in more than a second ?

comment:3 Changed 5 years ago by bill

http://kryogenix.org/days/2009/07/03/not-blocking-the-ui-in-tight-javascript-loops seems pretty good to me for explaining a design practice. I thought google would give me more links but I couldn't find others right away. There's no simple rule about what "takes more than a second" because it depends on the browser and hardware.

BTW, besides the locked screen usability problem, if the callback runs for >5s then browsers start to pop up the "this page has a long running script, should I kill it?" dialogs.

comment:4 Changed 4 years ago by cjolif

Owner: set to Sebastien Brunot
Status: newassigned

sbrunot did you find that in an actual application? or is that just "monkey" testing?

comment:5 Changed 4 years ago by Sebastien Brunot

It was found in a real application (supposedly from a problem reported on stackoverflow or the dojo mailing list), but I don't remember which one.

comment:6 Changed 4 years ago by bill

Presumably though this was already fixed by db467f31dc27a3eebdd3b3d43856479c2f3151c4 for #17634. This ticket is a much better description of the root problem, but I suggest we close this ticket as a duplicate of #17634.

a776e1ec8117dccfce8c8ad88e571a50e89db82a for #17815 may also be relevant.

Last edited 4 years ago by bill (previous) (diff)

comment:7 Changed 4 years ago by bill

Resolution: duplicate
Status: assignedclosed

Duplicate of #17634.

Note: See TracTickets for help on using tickets.