Skip to content

checkIsSoftKeyboardUp

Decides whether the IME is up, from how far the field moved.

The verdict is a delta: the field must have risen from where it sat before the touch, by at least minimumKeyboardHeightInPixels. Obsidian Mobile lifts whatever is on screen to make room for the IME, so a field that has not moved has had no keyboard arrive under it — whether it is a bottom-anchored suggester or a centred modal.

The one case this gets wrong, deliberately: a keyboard that was already up before the baseline was read. The field has nowhere left to lift to, so the answer is false. No amount of geometry separates that from a centred modal with no keyboard — both read as “clear of the bottom and not moving” — and of the two possible wrong answers, a loud false is the one worth keeping: it fails a capture rather than silently returning a screenshot of a keyboard that is not there. Read the baseline with the keyboard down, which is what raiseSoftKeyboard does.

Import:

import { checkIsSoftKeyboardUp } from 'obsidian-integration-testing';

Signature:

function checkIsSoftKeyboardUp(params: CheckIsSoftKeyboardUpParams): boolean

Parameters:

ParameterTypeDescription
paramsCheckIsSoftKeyboardUpParamsThe geometry before and after the touch, and how far the field must have lifted.

Returns: boolean — Whether the field lifted far enough to have made room for a keyboard.


Links to this page: