Opened 7 years ago

Closed 4 years ago

#16853 closed enhancement (patchwelcome)

propagatable property of dojox.mobile.scrollable.js does not allow event propogation

Reported by: MyPoints Owned by: Patrick Ruzand
Priority: undecided Milestone: 1.13
Component: DojoX Mobile Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:

Description

In the last line of the onTouchStart method of mobile/scrollable.js there is:

this.isFormElement(a.target)
(this.propagatable ? a.preventDefault() : p.stop(a))

which would (correctly) seem to indicate that even when propagatable is set to true, the touch event is prevented/stopped/canceled from propogating.

The use case:

A carousel of images at the top of the page (above the fold), each 320x250, each wrapped in a SwapView?. More content is below the carousel (below the fold) but the user is unable to swipe/scroll the mobile browser vertically by touching/swiping the carousel image - only the horizontal carousel scroll works.

It seems like the propagatable property should be used to allow default event handling but the event is stopped regardless if its value.

My hopefully temporary workaround/hack is to use a button tag inside the SwapView? instead of an image tag. The buttons background is set to be the image.

Functionally this works as desired but ideally the same event propagation allowed to form elements in mobile/scrollable.js would also be allowed when the propagatable properrty is true.

Change History (6)

comment:1 Changed 7 years ago by Eric Durocher

When propagatable is true, the event correctly propagates to other possible listeners for the touch event. But in all cases (except Form widgets), we call preventDefault(), and this is what prevents native browser scrolling.

So, the code works as expected and it would be dangerous to change the behavior, although I understand your case and why you want that. Your hack works in your case because scrollable.js scrolls only horizontally, and the browser only scrolls vertically, so there are no conflicts. But if both scrolled in the same direction (which we cannot really guess easily), it would get strange.

I guess the best we could do would be to add another flag to tell scrollable.js not to call preventDefault() at all, and warn about the possible side effects...

comment:2 Changed 7 years ago by MyPoints

Thanks for your comment - yes, I figured it was something as you describe since scrollable.js is sort of deep and used by a few modules. Adding a new property would be ideal - maybe possibly doing a check on the value of scrollDir before allowing the new property to propagate events fully? Might minimize some of the potential issues. Thanks again for the quick response.

comment:3 Changed 7 years ago by Sebastien Brunot

Maybe this ticket should be turned into an enhancement request ?

comment:4 Changed 7 years ago by Eric Durocher

Type: defectenhancement

comment:5 Changed 7 years ago by Patrick Ruzand

Owner: changed from Eric Durocher to Patrick Ruzand
Status: newassigned

comment:6 Changed 4 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: assignedclosed

Given that no one has shown interest in creating a patch in the past 2+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.