Opened 7 years ago

Closed 7 years ago

#16438 closed defect (fixed)

touch.release behavior different for mouse vs. touch

Reported by: bill Owned by: bill
Priority: undecided Milestone: 1.9
Component: Events Version: 1.8.1
Keywords: Cc: Eric Durocher
Blocked By: Blocking:

Description (last modified by bill)

When you setup a touch.release listener on a node:

on(nodeX, touch.release, callback)

...the behavior is different for mouse vs. touch:

  • on desktop, the callback fires if the mouse button is released while the cursor is over nodeX (regardless of where the cursor was on mousedown)
  • on touch devices, the callback only fires if the touch event started on nodeX, and regardless of where the user dragged his finger before removing it from the screen

Technically dojo/touch is working according to its spec -- listening to mouseup or touchend -- but the behavior is not in the spirit of dojo/touch, which is to normalize behavior between mouse and touch events.

So it's not a bug per se, but something that leads to bugs in applications that assume touch.release works the same for mouse and touch.

As a side note, most of the uses of touch.release within dojo are on the document object itself, rather than a node within the document, so there's no issue of which node the event is fired on. It looks like the one case where the listener is on a different node is for dojo/dnd/Moveable, but in that case the finger goes down and up on the same node because the node moves along with the finger.

Not sure if it's kosher to "fix" this behavior before 2.0, although we could uncontroversially add a new normalized release event. Or two normalized events: I think a lot of code, such as the code to drag the sliders in BorderContainer, would actually prefer touch.release to work for mouse events the same way it currently works for touch events.

This ticket reduced from #16427.

Change History (6)

comment:1 Changed 7 years ago by bill

#16427 is a duplicate of this ticket.

comment:2 Changed 7 years ago by bill

Description: modified (diff)

comment:3 Changed 7 years ago by bill

Cc: Eric Durocher added

@edurocher - I was going to mark this for 2.0 since it technically breaks back-compat, but maybe we need to do it for 1.9, to make behavior consistent across Webkit and Windows Surface.

I'm talking about your patch on #16175 which equates touch.release to MSPointerUp (on Surface). ISTM MSPointerUp makes touch.release fire based on the node the finger is over when it's removed from the screen, rather than the node that was originally touched. Can you confirm that?

comment:4 Changed 7 years ago by Eric Durocher

I cannot say what happens on an actual touch device since I don't have any yet. For mouse events, running test_touch.html on Windows 8 / IE10 + my patch (i.e. listening to MSPointer events), the behavior is the same as you describe for desktop: nodeX receives touch.release if and only if you release inside nodeX.

Can anybody else test this on an actual Windows 8 touch-enabled device?

comment:5 Changed 7 years ago by bill

Milestone: tbd1.9
Owner: changed from Kris Zyp to bill
Status: newassigned

comment:6 Changed 7 years ago by bill

Resolution: fixed
Status: assignedclosed

In [30557]:

Fix touch.release event to fire depending on which node the finger is over when it's released, rather than which node was initially touched, fixes #16438 !strict.

Note: See TracTickets for help on using tickets.