Safari on iOS 11.4 ignoring the 'touch-action: manipulation' property

I ran into an issue while developing a React web app that I want to work seamlessly across different platforms. My goal was to allow users to interact with a div element by double-clicking on desktop and double-tapping on mobile devices.

However, when testing the app on iOS (specifically targeting Safari version 11.4), every double-tap triggered a 'double tap to zoom' action instead of interacting with the div as intended.

After some investigation, I learned that using touch-action: manipulation in my CSS should resolve this problem, as it is supposed to be supported by Safari on iOS (https://caniuse.com/#feat=css-touch-action).

To test this solution, I created a simple React project, but unfortunately, the issue persisted regardless of the implementation.

I'm hoping for some insights from the community to help me figure out what I might be overlooking. Any assistance would be greatly appreciated!

You can find my straightforward React project on GitHub here: https://github.com/erlloyd/touch-action-bug, along with the relevant code snippets:

App Component

import React, { Component } from 'react';
import './App.css';

class App extends Component {
  render() {
    return (
      <div className="App">
      </div>
    );
  }
}

export default App;

App.css

.App {
  width: 100px;
  height: 100px;
  margin-left: 10px;
  margin-top: 10px;
  background: blue;
  touch-action: manipulation;
}

Relevant meta tags:

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

Answer №1

If you check out the recent comments on the original WebKit feature request, you might find them helpful.

It seems that in the example mentioned, the touch-action: manipulation div is not clickable, which causes us to skip that node when looking for a clickable element for the touch. To confirm this, try adding an onclick function to the div with touch-action manipulation, and you should see faster touch responses.

This link demonstrates that the property does work when the object is clickable, and my testing shows that the double-tap zoom behavior doesn't occur on the "manipulation" box.

To solve this issue, simply add an onClick event to your div like so:

class App extends Component {
  render() {
    return (
      <div className="App" onClick={e => e.preventDefault()}>
      </div>
    );
  }
}

Answer №2

While iOS Safari does support touch-action: manipulation and touch-action: auto, I discovered a bug where it does not function properly for input elements - causing the page to zoom in on double tap. Check compatibility here

Answer №3

As documented on Wikipedia, Safari and Mobile Safari are not compatible with the CSS property

touch-action:manipulation</p>
</div></answer3>
<exanswer3><div class="answer" i="53823625" l="4.0" c="1545073381" v="-1" a="bmlram9obg==" ai="1409180">
<p>According to <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action#Specifications" rel="nofollow noreferrer">MDN</a>, Safari and Mobile Safari do not have support for <code>touch-action:manipulation

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

Issue with API showing return value as a single value instead of an array

My database consists of collections for Teachers and Classes. In order to fully understand my issue, it's important to grasp the structure of my database: const TeacherSchema = new Schema( { name: { type: String, required: true } ...

How can I handle JSON data that contains undefined values?

Similar Question: Is it possible to parse JSON with special 'undefined' values using JavaScript? I'm curious if there's a way to parse something like javascript JSON.parse('{ "name": undefined}'); that is generated by an API ...

"What is the most effective way to utilize and integrate the `setValue` function from react-hook-form within a custom react hook

Struggling to pass setValue to a react hook? In my custom react hook, I need to set values in a form using react-hook-form's setValue. Yet, after migrating from v6 to v7, I'm having trouble figuring out the proper typing for this. This is how t ...

The expo-location feature is failing to accurately record and store all of the positions within the array

Incorporating expo-location in my react-native app, I utilize it to track the user's positions and store them in a redux object. While debugging the object reveals that all positions have been successfully inserted, upon retrieving this array, it turn ...

Event to discard currently selected pushpin in Bing Maps v8

There are two event styles available for a pushpin in Bing. enableHoverStyle : Boolean enableClickedStyle : Boolean To see these events/styles in action, visit the link below: My goal is to deselect an already selected pin when another pin is selected. ...

Is there a method to programmatically clear cache in an Angular 7 application?

I am facing an issue with my component that lazy loads images. The first time the page loads, the images are displayed using lazy loading. However, if I refresh, reload, or close and reopen the tab, the images are pre-loaded from the cache. Is there a wa ...

Having trouble initiating npm?

I am currently learning Angular2, and I encountered some issues when trying to initiate the npm server by running npm start in the project's directory. Here are the errors I received: > <a href="/cdn-cgi/l/email-protection" class="__cf_email__" ...

The absence of HTML and CSS is preventing the inclusion of an Ajax image viewer, back button, and

Currently, I am experimenting with jQuery and JavaScript to create an ajax overlay image viewer for a PHP website. After adding this code snippet at the end of the 'gallery page', I can successfully open the viewer and navigate using the next and ...

Can anyone tell me what js stands for?

I stumbled upon this snippet of code and am curious about what it does. Is it some sort of array? test = {a: [1,0,0], b:[0,1,0], c:[0,0,1]}; If I wanted to access the array for A specifically, how would I do that? console.log(bases[a]); This results in ...

What is the best way to add values to a JavaScript object using jQuery or plain JavaScript?

I have an object here and I am looking to dynamically insert values into it. var mergTr={}; //object for(dd in dispID) { var dataID=displayObj[dispID[dd]]; if(dataObj[dataID]) { var flag=0; var v ...

Creating tilted divs with dynamic height to perfectly fit the content

I'm struggling to incorporate this design into my webpage; I can't seem to get the right div's height to match the left div as depicted in the second image. Can someone offer some assistance? Additionally, when viewed on mobile, the squares ...

Enhanced Rating System for Asp.Net

How can I retrieve the selected value (CurrentValue) of the ASP.NET Rating control in javascript? I have it implemented within a datagrid, and I am facing difficulty in accessing the CurrentValue property. Any suggestions or solutions for this issue woul ...

What is the best way to arrange two buttons in a row with a border separating each row?

I am currently working with angular 8 and I am in need of creating a webpage design using HTML, CSS, or Bootstrap. The issue I am encountering is how to align every two buttons next to each other with borders, and once the first row is completed, move to ...

How can specific times be disabled using Laravel-9 jQuery Timepicker?

$(document).ready(function(){ $('#time').timepicker({ timeFormat: 'h:mm a', interval: 60, minTime: '9', maxTime: '4:00pm', defaultTime: '9', startTime: '9:00', dyna ...

A step-by-step guide to integrating npm python-shell in a React JS application

I am looking to execute and showcase some simple python code using the python-shell package. Can the package be used with react js? Below is a code sandbox where I have included a sample script "x=1+1;print(x)". Is there a method to run this script when a ...

The deletion by index feature seems to be malfunctioning in Angular

Is there a way to delete an item by its ID instead of just deleting the last element using this code? I want to create input fields with a delete button next to each one simultaneously. TS: public inputs: boolean[] = []; public addNew(): void { this ...

Creating a realistic typewriter effect by incorporating Code Block as the input

I am looking to add a special touch to my website by showcasing a code segment with the Typewriter effect. I want this code block not only displayed but also "typed" out when the page loads. Unfortunately, I have been unable to find a suitable solution s ...

Issue with animation when deleting a table view cell

-(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { [self.myArray removeObj ...

The div has extra white space at the bottom due to the Hide/Show content feature

Having trouble stretching a scrolling div to 100% of its parent container's height? The Hide/Show content feature is causing whitespace at the bottom of the div. Check out the jsfiddle here: http://jsfiddle.net/fkvftff2/1/ LATEST UPDATE: The issue a ...

What is the best way to choose all initial elements within a single row using CSS?

Is it possible to target all the first elements in a single row? I know this is an unusual request, but I have a row that contains block elements. I want to apply CSS styling to each of the first elements. Here is the row: <ul class="slides"> &l ...