IMDTouchKnowledge BaseShop main store

Troubleshooting

CODESYS WebVisu Long Touch Opens Right-Click Menu: Fix It

HMI and touchscreens Published 8 min read

Short answer

Chromium's gesture recognizer, not the touch driver or libinput, turns a held touch into a right-click on a CODESYS WebVisu button. Enable the Multitouch option in the visualization so press and release map to touch events directly; on runtimes older than CODESYS Visualization 4.8.0.0, also start Chromium with --kiosk to suppress the popup. Then prove the release path in the PLC with a watchdog, because a lost client ends the touch stream without any release event.

On this page
  1. Why a long press becomes a right-click
  2. Why the driver-level fixes do nothing
  3. Enable the Multitouch option
  4. The version that kills the menu by itself
  5. Run Chromium in kiosk mode and plan the way out
  6. A context menu belongs in the design, not in the gesture stream
  7. Prove the release path in the PLC
  8. Worked example: watchdog numbers in the PLC
  9. The decision for each case
  10. Questions asked

A jog button that works with a USB mouse but fails on the panel's own touchscreen is not a touch-driver problem. On the setup that showed this fault — a Raspberry Pi 3B+ running CODESYS V3.5 SP14 with CODESYS Control for Raspberry Pi SL and the WebVisu in Chromium — a held button pops a context menu after roughly half a second, and the jog variable can stay TRUE after the finger lifts. Chromium's gesture recognizer, sitting above the touch driver, converts the held contact into a right-click. Enable the Multitouch option in the visualization so press and release bind to the touch events directly; on runtimes older than CODESYS Visualization 4.8.0.0, also start Chromium with --kiosk to suppress the popup; then prove the release path in the PLC with a watchdog.

Why a long press becomes a right-click #

The touch driver never sends a mouse button. X11 and libinput hand Chromium a plain contact sequence — touchstart, zero or more touchmove, then touchend or touchcancel. Chromium's gesture recognizer inspects that stream and, when a contact holds still past its long-press delay, synthesizes a contextmenu event and paints the popup inside the browser, above the driver. The delay itself is not published; on the panel that showed this fault the menu landed after about half a second of holding.

The WebVisu side fails in parallel. Without the Multitouch option the client never binds to the touch events; it acts on the compatibility mouse events Chromium emits after a completed tap. A long press ends as a contextmenu instead of a matching mousedown and mouseup pair on the element, so a variable set TRUE at press has nothing to reset it — the release the axis is waiting for never arrives. A button left in its pressed state after release is the same family of fault as why a WebIQ button stays highlighted after touch release; the difference is only which layer swallows the release.

Why the driver-level fixes do nothing #

Every operating-system lever aims at the wrong layer:

  • xmodmap remaps physical mouse buttons. A long touch presses none of them, so the remap never fires.
  • libinput parameters for right-button emulation apply to touchpads and pointer devices, not to the touchscreen-to-gesture path inside a browser.
  • Chromium command-line switches for touch emulation change how touch is fed into the renderer, not whether the gesture recognizer fires a long-press.
  • Swapping the panel changes nothing either: the identical popup appeared on a second 10-inch touch display from a different maker, because the menu is drawn in the browser, not in the panel controller.

Enable the Multitouch option #

Multitouch is the root fix for the button behavior. On the setup that showed the fault, that single option turned the broken jog button into a working one: press latched, lift-off released.

  1. Open the project in the CODESYS development system and select the visualization object the browser is running.
  2. Enable the Multitouch option in the visualization settings. Depending on the service pack it appears both on the visualization manager and on the individual visualization object — enable it wherever it is offered.
  3. Keep the client resolution configured for the panel so touch coordinates and element hit boxes stay aligned.
  4. In the jog button's input configuration, use the Tap action with the jog variable assigned, and take the option that sets the variable FALSE when the finger leaves the element. Leave the repeat-style Hold action out of a jog design: it re-triggers on a cycle interval and is built for repeat-key behavior, not for a maintained output.
  5. Download the project to the controller. The visualization is regenerated at download — a browser reload against the stale client will not pick the option up. The transfer also restarts the runtime, so variable values reset with it; if that bites a different tuning job, see why HMI variable values reset after a transfer.
  6. Reload the page in Chromium with a cache bypass — Ctrl+Shift+R — so the updated client scripts replace the cached ones.

The version that kills the menu by itself #

Multitouch fixes the variable, but on the runtimes involved here Chromium could still paint the menu over the screen. That half changed at the client level: the CODESYS Visualization 4.8.0.0 release notes record that the context menu is disabled for touch inputs on the WebVisu. From that visualization version on, a long touch no longer opens the popup in the client itself, and kiosk mode moves from repair to hardening. The setup that showed this fault ran CODESYS V3.5 SP14, well before that change, so it needed both halves of the fix.

Run Chromium in kiosk mode and plan the way out #

On runtimes older than 4.8.0.0, start Chromium with --kiosk. The page runs full screen with no toolbar and no window decorations, and a right-click — physical or synthesized from a long touch — has no menu to open. A production panel wants this anyway, because it also stops an operator leaving the visualization for the desktop.

The cost is real: with no chrome there is no obvious way back out. Handle the exit deliberately rather than avoiding kiosk mode:

  • Keep an SSH session available and stop the browser process from it.
  • Bind a key combination in the window manager to close the browser, or drop to a text console with Ctrl+Alt+F2 for maintenance.
  • Launch the browser from a script that restarts it in a loop, so an exit relaunches the visualization instead of leaving a bare desktop on the machine.
  • On an operator-facing panel, intercept the keyboard shortcuts that still reach the window — Ctrl+W and Alt+F4 among them.

During commissioning, validate the Multitouch behavior without kiosk first, then switch the startup command for handover.

A context menu belongs in the design, not in the gesture stream #

Nothing is wrong with a context menu a station asks for. Mouse-driven HMIs implement them deliberately — FactoryTalk View SE implements a right-click context menu as an explicit design feature — and browser-based clients control the menu behavior in their own configuration, the way Ignition Perspective disables a table's right-click context menu. On a touch panel, though, a menu synthesized from a hold is a defect: the operator asked for a maintained press, not a popup.

Prove the release path in the PLC #

A latched jog output is a motion hazard, so verify the release path, not just the press path. Watch the jog variable in the PLC while you exercise the panel:

  • Short tap: the variable goes TRUE, then FALSE. Baseline.
  • Press, drag the finger off the button, release outside it: the variable must return FALSE. This is the case the leave-element clearing in step 4 covers, and the one that most often leaves an output stuck.
  • Force a cancelled gesture — swipe from the screen edge or set off a system gesture: Chromium ends the contact with touchcancel instead of touchend, and the variable must still clear.
  • Two fingers on two jog buttons: with Multitouch active, both contacts report independently. Decide whether the machine may allow that and interlock it in the PLC if it must not.

Finish by breaking the client on purpose: hold the button and pull the network cable, or kill the browser process. The touch stream ends with no release event at all — exactly what a WLAN dropout or a browser crash produces — and only a controller-side timeout stops the feed.

Worked example: watchdog numbers in the PLC #

Never let a browser event be the only thing that stops motion. Back the jog command with two timers in the PLC: an activity watchdog on a variable the client keeps toggling while the button is held, and a maximum press duration. The variable names below are illustrative; the pattern is plain IEC 61131-3 structured text:

VAR
    xJogFwd    : BOOL := FALSE;  // set by the WebVisu button
    xHeartbeat : BOOL := FALSE;  // toggled by the client while the button is held
    xHeartOld  : BOOL := FALSE;
    xJogPermit : BOOL := FALSE;  // actually commands the axis
    tonJogLost : TON;
    tonJogMax  : TON;
END_VAR

tonJogLost(IN := (xHeartbeat = xHeartOld), PT := T#500MS);
tonJogMax(IN := xJogFwd, PT := T#10S);
xHeartOld  := xHeartbeat;
xJogPermit := xJogFwd AND NOT tonJogLost.Q AND NOT tonJogMax.Q;

The timer values are example settings, sized like this. Take a slowest client that updates its variables every 200 ms; the worst gap between two heartbeat toggles is then 200 ms, and a 500 ms watchdog window gives 500 ms / 200 ms = 2.5 updates of margin, so ordinary jitter never trips it while a dead browser trips it within half a second. The maximum press timer caps everything left over: 10 s / 0.5 s = 20 watchdog windows, so even a heartbeat that keeps toggling behind a stuck tag is cut off at ten seconds. If the drive needs 300 ms to bring the axis to standstill, the worst case from the last client contact is 500 ms + 300 ms = 800 ms. Keep the watchdog at that same margin — about two and a half times the worst-case update interval — and set the maximum press to whatever the process tolerates.

The decision for each case #

  • Runtime at CODESYS Visualization 4.8.0.0 or later: enable Multitouch. The client already suppresses the touch context menu; add kiosk mode only as hardening, so the panel cannot be exited.
  • Runtime older than 4.8.0.0, like the V3.5 SP14 setup that showed this fault: enable Multitouch and start Chromium with --kiosk, with the SSH or keybound exit planned before handover.
  • Any jog or maintained output, on every version: the PLC watchdog from the worked example, proven by killing the client mid-press. The browser event is never the only thing that stops motion.

Questions asked

Does the long-press problem depend on the touchscreen hardware?

No. The same popup appeared on the original 7-inch display and on a second 10-inch panel from a different maker, because the menu is synthesized inside Chromium above the touch driver. Any touch panel that hands the browser the same contact sequence behaves the same way, so replacing the panel or its controller cannot fix this fault.

Does enabling Multitouch change anything else in the project?

Yes. It switches the client from synthesized mouse events to the raw touch sequence, so simultaneous contacts report independently. Retest any logic that assumed a single pointer, and if the machine must not allow two jog presses at once, interlock that in the PLC program. The visualization will happily deliver both presses to the controller.

How do I know whether my runtime already suppresses the menu?

Compare the version of the CODESYS Visualization component your runtime reports against the 4.8.0.0 release notes, which record that the context menu is disabled for touch input on the WebVisu. At that version or later the popup is handled in the client; earlier runtimes, such as the V3.5 SP14-era setup that showed this fault, still need kiosk mode.

What ends a touch with touchcancel instead of a normal release?

The browser abandons the contact when something else claims it: an edge swipe, a system-level gesture, a second contact it assigns elsewhere, or the window losing focus mid-press. The client receives touchcancel with no matching release on the element, so a variable set at press stays set unless code clears it on the cancelled case. The PLC watchdog clears it regardless of how the gesture ended.

Does an external USB mouse still work after Multitouch and kiosk mode?

Yes. A physical mouse sends real button events, so press and release reach the element one-to-one with or without the Multitouch option, and kiosk mode removes the context menu without touching mouse clicks. A panel can keep a mouse available for engineering access while operators run the machine from the touchscreen.

Keep reading

  • How-to

    How to Set Up Granular User Access on a CODESYS Touch Panel

    Yes: a CODESYS panel takes any number of users. Activate user management in the Visualization Manager, add accounts and passwords in its user management editor, then tick the per-element user checkboxes that appear on every visualization element. Changing or removing the login password changes only the gate, never per-control rights; the defaults are admin, Operator and user.

    HMI and touchscreens

  • How-to

    How to Enter Configuration Mode on a Touch HMI

    On a touch-only operator terminal you enter Configuration Mode by cycling power and pressing the small filled box that appears briefly in the lower-right corner during startup, while hold-both-arrow-keys instructions apply to keypad terminals with physical keys. An application button labeled GoTo Config. Screen reaches the same menu without a reboot.

    HMI and touchscreens

  • How-to

    How to Fix Overlapping Graphics Hiding HMI Symbols

    Put the static background picture inside a frame container so it sits behind the process symbols, bring each symbol forward through the editor's object list, and leave the generated source alone. Assign z-values ten apart by role so new layers insert without renumbering. Stacking fixes visibility only; click handling and state-driven colors need their own runtime checks.

    HMI and touchscreens

How to Style a Pressed Button State on a Touch HMI