Skip to content

clickElement

Clicks the center of an element using trusted touch input — a CDP tap in the WebView, injected by the host.

The element-relative counterpart of clickMouse. button: 'right' is the long-press that opens Obsidian Mobile’s context menu; 'middle' throws, because touch has no gesture for it and inventing one would be worse than saying so.

Import:

import { clickElement } from 'obsidian-dev-utils/obsidian/mobile-trusted-input';

Signature:

function clickElement(params: ClickElementParams): Promise<void>

Parameters:

ParameterTypeDescription
paramsClickElementParamsThe element to click, the button to press and any modifiers to hold.

Returns: Promise<void> — A Promise that resolves once the click has been injected.


Links to this page: