# Triggering onContextMenu Events from the Perspective IOS App

**URL:** <https://forum.inductiveautomation.com/t/triggering-oncontextmenu-events-from-the-perspective-ios-app/68638>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [January 16, 2023, 6:47pm UTC](https://forum.inductiveautomation.com/t/triggering-oncontextmenu-events-from-the-perspective-ios-app/68638 "2023-01-16T18:47:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mmunin](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@mmunin](https://forum.inductiveautomation.com/u/mmunin)\
**Post date:** [January 16, 2023, 6:47pm UTC](https://forum.inductiveautomation.com/t/triggering-oncontextmenu-events-from-the-perspective-ios-app/68638/1 "2023-01-16T18:47:58Z")

</div>

We have a perspective HMI application that is used by operators both on laptops and on mobile IOS devices, split about 50/50. On the laptops, our operators can right click certain components in the app to trigger the "onContextMenu" event, prompting them to add tags to quick trends, etc.

However, we have not been able to replicate this functionality to a "long press" in the IOS apps. Trying a long press on a button component simply highlights the button's text instead of triggering "onContextMenu."

Even still, attempts to manually program a "long press" by sleeping an "invokeAsynchronous" thread and checking if the button is still held down only work with an actual mouse. Pressing and holding the button in Perspective IOS still just selects the button's text.

In the Perspective App for Android, it still selects the button's text, but it DOES trigger the "onContextMenu" event.

It would seem from these symptoms that there is either a bug or an OS limitation that is preventing the perspective app in IOS from triggering the "onContextMenu" event when long pressing a button. If it's a bug, I sure hope we can see an update eventually? If it's a limitation, then well... crap. I guess that's what we get for using IOS devices.

---

<div class="post-metadata">

**Author:** ![nicoli.liedtke](https://avatars.discourse-cdn.com/v4/letter/n/ee59a6/32.png) [@nicoli.liedtke](https://forum.inductiveautomation.com/u/nicoli.liedtke)\
**Post date:** [January 17, 2023, 12:37am UTC](https://forum.inductiveautomation.com/t/triggering-oncontextmenu-events-from-the-perspective-ios-app/68638/2 "2023-01-17T00:37:36Z")

</div>

Unfortunately I think this is just expected behavior for React Apps on IOS. Since Ignition Perspective uses React this may just be the behavior to expect. The Github issue below discusses this issue for React. It does have a workaround fix that with some decent effort could probably be implemented into Ignition as well.

> <https://github.com/facebook/react/issues/17596>
>
> \<!--
> Note: if the issue is about documentation or the website, please file it… at:
> https://github.com/reactjs/reactjs.org/issues/new
> \--\>
> 
> \*\*Do you want to request a \*feature\* or report a \*bug\*?\*\*
> bug
> 
> \*\*What is the current behavior?\*\*
> onContextMenu event does not get fired on iOS 13.1 when long-pressing on an iPhone.
> 
> https://codesandbox.io/s/awesome-wilson-t1yy3
> 
> Clicking the gray rectangle should print 'onClick', which it does on all platforms I tested.
> Long-pressing/right-clicking on the gray rectangle should print 'onContextMenu', which it does on windows and android, but not on iOS. Tested on both chrome and safari.
> 
> \*\*What is the expected behavior?\*\*
> The expected behaviour on iOS is that long-pressing the gray rectangle should print 'onContextMenu'.
> 
> \*\*Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?\*\*
> React 16.12.0
> iOS 13.1
