Opened 7 years ago
Closed 6 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)
Change History (8)
Changed 7 years ago by
Attachment: | dojoClick.html added |
---|
comment:1 Changed 7 years ago by
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 7 years ago by
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 7 years ago by
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 6 years ago by
Owner: | set to Sebastien Brunot |
---|---|
Status: | new → assigned |
sbrunot did you find that in an actual application? or is that just "monkey" testing?
comment:5 Changed 6 years ago by
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 6 years ago by
comment:7 Changed 6 years ago by
Resolution: | → duplicate |
---|---|
Status: | assigned → closed |
Duplicate of #17634.
Example that reproduce the issue on a mobile device.