Identifying a touch event-related bug specific to a device and browser on iOS that is passive in nature

In my project, I have observed a peculiar behavior that only occurs on specific devices and browsers.

The desired behavior involves using Device Orientation Controls (Three.js) for users to "look around" and utilizing this virtual joystick library for movement, which generally works well across most devices:

- Demonstrating the functionality on Chrome with an iPhone 7

THE ISSUE: However, in the second video (), when I initiate movement and the joystick appears, the Device Orientation Camera freezes until I release the joystick, then it abruptly corrects itself. In the video, I perform a 'long press' before moving, which eliminates the freezing (hopefully visible).

This discrepancy occurs specifically on Safari and Chrome with an iPhone 11. Interestingly, it does not manifest the same way on Chrome with an iPhone 7 or X, despite all using the same Chrome version (83.0.4103.88).

I also noticed that on an iPhone 7 using Safari, visiting the official Device Orientation Controls example allows me to manipulate the site's orientation, triggering a similar freezing effect on the camera.

Upon exploring, I came across the use of preventDefault in virtualjoystick.js and learned about the need to declare passive: false in event listeners. I attempted to implement this in the touch event listeners of virtualjoystick.js:

(Code snippet provided)

Despite these adjustments, the freezing persists, and it did not provide the immediate solution I had hoped for. The code snippet in question also triggers an error message in the console:

virtualjoystick.js:255 [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive
.

Additionally, the part of my animate() function responsible for handling joystick inputs is as follows:

(Code snippet provided)

If anyone has insights or suggestions to guide me in troubleshooting this issue, I would greatly appreciate it.

Answer №1

To resolve the issue I was facing, I found that simply including the CSS rule touch-action: none; on the body of my application did the trick! Problem solved.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The Angular Animation constantly resets with each new action taken

In my Angular project, I am working on a scaling animation for a list. I want the animation to only trigger when specific buttons (red and green) are pressed. Currently, the animation restarts regardless of what I click on. Can anyone help me troubleshoot ...

Managing selected ticket IDs in a table with AngularJS

I have a table that includes options for navigating to the next and previous pages using corresponding buttons. When I trigger actions for moving to the previous or next page (via controller methods), I store the IDs of checked tickets in an array $scope. ...

Clicking on hyperlink within email to open in default web browser

I am facing a problem with my Angular web app. Here is the scenario of the issue: When I send a link to my app via email and try to open it from a mobile email client using a short version of a browser or webview (not sure what it's called), I encou ...

What is the best way to deactivate the second selection option?

<select id="title0"> <option value="0">--- disable</option> <option value="1"> books</option> </select> <button id="save" type="submit">Save</button> <select id="title1"> <option value="0"& ...

Using HTML and JavaScript to add variables into the URL within the window.location

I have been struggling to incorporate longitude and latitude into the URL. Despite researching various topics online, I have not found a solution that works for me. Below is the HTML code that showcases the issue. When you click the "Show Position" button ...

Does CSS in the current IE9 beta allow for text shadows to be implemented?

Text shadows look great in Firefox and Chrome. For example, I have a basic website for streaming videos. Unfortunately, there are no shadows in IE9 for me. This is my CSS code: p { color: #000; text-shadow: 0px 1px 1px #fff; padding-bottom: 1em; } ...

jQuery introduces additional elements while parsing HTML code

If you have an HTML string that needs manipulation using jQuery, you may encounter the issue of jQuery adding additional tags to the string. To avoid this problem, you can follow this approach: var html = marked(input); //returns an html string console.lo ...

Adding additional rows to an Array Object in JavaScript based on a certain condition

I am faced with a scenario where I have an array object structured as follows [ { id: 123, startdate: '2022-06-05', enddate: '2023-04-05' },{ id: 123, startdate: '2021-06-05', enddate: '2021-04-05' } ] The task at h ...

Transforming Observable into a Promise

Is it considered a best practice to convert an observable object to a promise, given that observables can be used in most scenarios instead of promises? I recently started learning Angular and came across the following code snippet in a new project using ...

The onload function on the iframe is triggering twice in Internet Explorer 11

I am encountering a strange issue with an iframe in HTML that has an onload function. When using IE11, the onload function is being triggered twice, whereas it works fine in Chrome. Here is the HTML code: <iframe src="someurl" onload="someFunction( ...

Seamless transition of lightbox fading in and out

Looking to create a smooth fade in and out effect for my lightbox using CSS and a bit of JavaScript. I've managed to achieve the fading in part, but now I'm wondering how to make it fade out as well. Here is the CSS code: @-webkit-keyframes Fad ...

When decoding a JWT, it may return the value of "[object Object]"

Having some trouble decoding a JSON web token that's being sent to my REST API server. I can't seem to access the _id property within the web token. Below is the code I'm currently using: jwt.verify(token, process.env.TOKEN_SECRET, { comp ...

What could be causing the error 'i is not defined' in my Vue.js component script when using a basic for loop?

I have a task where I need to sort an array by version and then move all elements starting with 'ipad' to the end of the list. This code snippet is extracted from a single file Vue.js component: computed: { orderedUsers: function () { ...

Implementing a function to navigate to a different page using jQuery mobile

I'm attempting to pass a function when changing pages in jQuery Mobile, but I keep getting an error that points to `$.ajax` $( ":mobile-pagecontainer" ).pagecontainer( "change", "#schoolperformance", { reload : true, showLoadMsg : false, ...

Does a .innerXML exist?

Is anyone knowledgeable in XML able to offer some assistance? I have a function that I use to parse XML data, and you can find the XML file I am working with here. function dialogXML(varName,url){ if (window.XMLHttpRequest){ r[varName]=new XML ...

How can a function be invoked in a child component from a parent component?

I am facing a challenge where I need to trigger the function showExtraBlogposts() in Blogpostreader.js upon clicking on a button rendered in Blog.js. Initially, I attempted to call it using onClick={Blogpostreader.showExtraBlogposts()} but it returned an ...

Tools to Evaluate Mobile App Performance

Currently, I am conducting tests on the application across Android and iOS platforms. The app utilizes the device's microphone and involves persistent network usage. Is there a straightforward Performance Testing tool that someone can recommend for a ...

Attempting to duplicate Codepen's code onto my local machine

Trying to figure out how to make this work locally after finding it on codepen https://codepen.io/oxla/pen/awmMYY Seems like everything works except for the functionality part. I've included the JS File and the latest Jquery in my code. <head&g ...

Using parameters in NativeScript-Vue

I'm having trouble passing parameters to another route in Nativescript. Every time I try, it shows up as undefined. I am using the nativescript-vue-navigator. On my current screen, I have this function call: this.$navigator.navigate('/map' ...

What methods can be utilized to conceal an if statement in code?

In my application, I am facing an issue with an external JavaScript file that contains multiple if statements. The problem arises when one of the if statements is still being executed even if the corresponding form is hidden. The flow of my application is ...