How to disable double tap to zoom on mobile

WebViewer Version: 11.4.0

Issue with specific file(s)?

No, any document exhibits the issue.

Reproducible using one of the samples or online demos?

Yes. The issue can be reproduced using the standard WebViewer demo or a minimal implementation created with WebViewer({ licenseKey, initialDoc, …}).

Are you using the WebViewer server?

No.

Does the issue only happen on certain browsers?

It only occurs on mobile browsers (Chrome on Android and Safari on iOS). It does not occur on desktop.

Is your issue related to a front‑end framework?

We are using React, but the problem also appears in a plain setup without a framework.

Is your issue related to annotations?

No.

Brief summary

Disable the automatic zoom triggered by a double‑tap when the PanTool is active or when double‑tapping inside a ContentEdit text box on mobile devices.

Detailed description and steps to reproduce

Instantiate WebViewer 11.4.0 with default settings.

Open the app on a mobile device (iOS or Android).

Select the Pan tool from the toolbar.

Double‑tap anywhere on the document.

On mobile, this double‑tap automatically zooms in. I’d like to disable this behaviour so that double‑taps do nothing when the PanTool is selected.

An additional scenario is when using the ContentEdit feature to edit text annotations. In a typical mobile UX, double‑tapping inside a text box should select a word. In WebViewer, double‑tapping inside the editing box triggers the global zoom instead of selecting the word. This makes text editing difficult.

What I’ve already tried:

Overriding mouseDoubleClick on the Pan tool to return false or call event.preventDefault(). This did not affect mobile.

Listening for the dblClick event on the DocumentViewer and calling preventDefault()/stopImmediatePropagation() on the native event

. The zoom still occurs.

Applying the CSS property touch-action: manipulation or pan-x pan-y to the viewer container to prevent double‑tap zoom

. WebViewer resets this to auto when tools change, so the zoom behaviour comes back.

Using a MutationObserver to re‑apply the touch-action value whenever WebViewer modifies it. This partly works but isn’t reliable.

Is there an official way to disable double‑tap zoom on mobile—both when the Pan tool is active and when double‑tapping inside ContentEdit text boxes? Or is there a supported method to override the handleDoubleTap behaviour for these cases?

Link to a minimal reproducible sample

The behaviour can be seen on the official demo: Apryse WebViewer Demo: JavaScript PDF Viewer Demo

(open on a mobile device, select the Pan tool, and double‑tap on the document; then edit a text annotation and try to double‑tap a word).

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


Disabling the double-tap to zoom feature in WebViewer, especially on mobile devices, requires some customization since it’s a native behavior. While WebViewer does not provide a direct API to disable this, you can try some workarounds to achieve the desired effect.

Some things you can try:

  • Override the default behavior for double-tap events by attaching an event listener to the viewer container and using event.preventDefault() to stop the zoom action.

  • Use CSS to set touch-action to none or manipulation on the viewer container. Although WebViewer resets this, a MutationObserver can be used to monitor changes and reapply the style.

  • Modify the behavior of the Pan tool or ContentEdit tool by customizing their event handlers. You can intercept double-tap events and prevent the default zoom action.

  • Consider using a custom tool that extends the existing Pan tool and overrides its double-tap functionality.



Here are some resources that might help you:

  • Tools Customization - Learn how to customize tools in WebViewer, which might help in overriding the double-tap behavior.

  • UI Customization Guide - Useful for understanding how to adjust the UI and handle events in WebViewer.

  • MutationObserver - MDN Web Docs - This can help you understand how to use MutationObserver to monitor and modify the touch-action CSS property dynamically.

  • WebViewer Getting Started - If you are new to WebViewer, this guide can help you set up and understand the basics.



Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

Hello @lndev,

Thank you for posting on our forum.

After some investigation, it was found that this behavior is part of our default UI configuration and we currently do not have any APIs/methods to disable this.

That said, there is currently a feature request raised to allow to disable this behavior that is on our backlog for our Product team to review. If you could provide some further information around the context of why you want the feature, this may help prioritize its development. We would be interested to know:

  • What is the workflow that you would use the requested feature in?
  • Why is the feature valuable to you and your users?
  • How are you coping without it right now?

In the meantime, the only way that this could be modified would be by forking our public UI and making the required changes. For guidance on building and integrating the custom UI, please refer to our advanced customization guide here: Advanced UI Customization | Apryse documentation

If you decide to go this route, you can find the file needed to be changed here as a good starting point: https://github.com/ApryseSDK/webviewer-ui/blob/11.7/src/helpers/TouchEventManager.js#L317-L328

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.

2 Likes