articles

Do Not Zoom

Intent

Disable zoom, or disable "double-tap to zoom".

Problem summary

Browsers support zooming through touch gesture, and Safari support "double-tap to zoom". These default features may be handy for content Websites, however, for Web apps with rich user interactions, such features may cause problems.

For example, when navigating a table with pagination and navigation buttons, John the user may tab the Forward button rather frequently and such action could be interpreted by the OS as double, and here come the undesired zooming.

Recently I have developed "Ishihara Color Blind Test" app. For the designed functionality, zoom makes not sense at all.

Solution

In the global css/scss, on interactive elements:

html, body {
  touch-action: manipulation;
}

button, a, .clickable, [role="button"] {
  touch-action: manipulation;
}

In the Webpage like index.html:

<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1, maximum-scale=1, user-scalable=no">

maximum-scale=1, user-scalable=no is the key change.

References:

Therefore, both zoom gesture and double-tap to zoom are disabled. However, on PC, mouse-wheel zooming is still working well, and this has nothing to do with the touch screen user experience.

If you would avoid accidental zooming and allow pinch gesture zoom, simply not to declare maximum-scale=1, user-scalable=no.

Remarks: