X
Tap here to go to the mobile version of the site.

Support Forum

On simulator "touchend" fires, but not on actual device

Posted

I have developed an app where you can swipe left or right to change content on screen. I detect swipe by looking at x-coord at touchstart and touchend and calculate the distance.

This works fine in the 1.3 simulator, but when I try it on my Open C FF OS 1.3 device, the touchend event never fires. (Touchstart fires as it should).

Please help. Stefan

I have developed an app where you can swipe left or right to change content on screen. I detect swipe by looking at x-coord at touchstart and touchend and calculate the distance. This works fine in the 1.3 simulator, but when I try it on my Open C FF OS 1.3 device, the touchend event never fires. (Touchstart fires as it should). Please help. Stefan

Additional System Details

Application

  • User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Firefox/31.0

More Information

Ralph Daub
  • Top 25 Contributor
  • Administrator
147 solutions 1114 answers

Hi steppohak,

You may have better luck finding help on developer-focused forums like StackOverflow:

The following MDN (Mozilla Developer Network) page also has some documentation about touch events:

I hope you're able to find a solution. Please let us know if you have any other questions!

- Ralph

Hi steppohak, You may have better luck finding help on developer-focused forums like StackOverflow: * [http://stackoverflow.com/questions/tagged/firefox-os] The following MDN (Mozilla Developer Network) page also has some documentation about touch events: * [https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Touch_events] I hope you're able to find a solution. Please let us know if you have any other questions! - Ralph

Question owner

Hi Ralph,

thanks for responding. Unfortunately it does not really help me. (Perhaps I could get help with a workaround from StackOverflow, but I already did one myself - using buttons instead of swipe - at the cost of worse user experience). Both resources are more targeting web app developers, but this is an issue with the _implementation_ in Firefox OS 1.3 (at least for my make and model of device).

Notably the second has a section on "Handling the end of a touch" based on the "touchend" event - but my problem is that the "touchend" event never fires.

I have filed a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1047804 but nothing has happened there so far.

- Stefan

Hi Ralph, thanks for responding. Unfortunately it does not really help me. (Perhaps I could get help with a workaround from StackOverflow, but I already did one myself - using buttons instead of swipe - at the cost of worse user experience). Both resources are more targeting web app developers, but this is an issue with the _implementation_ in Firefox OS 1.3 (at least for my make and model of device). Notably the second has a section on "Handling the end of a touch" based on the "touchend" event - but my problem is that the "touchend" event never fires. I have filed a bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1047804 but nothing has happened there so far. - Stefan

Modified by steppohak

Ralph Daub
  • Top 25 Contributor
  • Administrator
147 solutions 1114 answers

Helpful Reply

Hi Steppohack,

Thank you for filing the bug and for providing additional details.

I know that there are apps with swipe capabilities that work well on the ZTE Open C, but I'm not sure how they implemented the swipe features.

I added QA to the bug so that they can investigate this issue.

Thanks,

- Ralph

Hi Steppohack, Thank you for filing the bug and for providing additional details. I know that there are apps with swipe capabilities that work well on the ZTE Open C, but I'm not sure how they implemented the swipe features. I added QA to the bug so that they can investigate this issue. Thanks, - Ralph

Question owner

Thanks Ralph!

Could you provide a pointer to (source for) other apps with swipe? Would be nice to see how they solved it.

Regardless, I think touchend should fire, so the bug should be fixed.

- Stefan

Thanks Ralph! Could you provide a pointer to (source for) other apps with swipe? Would be nice to see how they solved it. Regardless, I think touchend should fire, so the bug should be fixed. - Stefan
Ralph Daub
  • Top 25 Contributor
  • Administrator
147 solutions 1114 answers

Hi Steppohak,

I don't know the source code of specific apps, but a lot of apps in the Marketplace as well as system apps incorporate swiping.

For example, please look at lines 95-104 of the Browser.js in the B2G's source code:

 /**
* Get elements from index.html.
* Add event listeners.
* Init BrowserDB and search engine.
*/
init: function browser_init() {
this.getAllElements();
// Add event listeners
this.urlBar.addEventListener('submit', this.handleUrlFormSubmit.bind(this));
this.urlInput.addEventListener('focus', this.urlFocus.bind(this));
this.urlInput.addEventListener('blur', this.urlBlur.bind(this));
this.urlInput.addEventListener('touchend', this.urlTouchEnd.bind(this));
this.urlInput.addEventListener('input',
this.handleUrlInputKeypress.bind(this));
this.urlButton.addEventListener('click',
this.handleUrlFormSubmit.bind(this));
this.tabsBadge.addEventListener('click',
this.handleTabsBadgeClicked.bind(this));

And there is also some Touch Events information on the following page:

I hope this information is helpful. Please let us know if you have any questions.

Thanks,

- Ralph

Hi Steppohak, I don't know the source code of specific apps, but a lot of apps in the Marketplace as well as system apps incorporate swiping. For example, please look at lines 95-104 of the Browser.js in the B2G's source code: * [https://github.com/mozilla-b2g/gaia/blob/master/apps/browser/js/browser.js] /** * Get elements from index.html. * Add event listeners. * Init BrowserDB and search engine. */ init: function browser_init() { this.getAllElements(); // Add event listeners this.urlBar.addEventListener('submit', this.handleUrlFormSubmit.bind(this)); this.urlInput.addEventListener('focus', this.urlFocus.bind(this)); this.urlInput.addEventListener('blur', this.urlBlur.bind(this)); this.urlInput.addEventListener('touchend', this.urlTouchEnd.bind(this)); this.urlInput.addEventListener('input', this.handleUrlInputKeypress.bind(this)); this.urlButton.addEventListener('click', this.handleUrlFormSubmit.bind(this)); this.tabsBadge.addEventListener('click', this.handleTabsBadgeClicked.bind(this)); And there is also some Touch Events information on the following page: * [http://mobiforge.com/design-development/html5-mobile-web-touch-events] I hope this information is helpful. Please let us know if you have any questions. Thanks, - Ralph