toeverything/AFFiNE · error
visualViewport is not supported
Error message
visualViewport is not supported
What it means
Warning logged by the mobile VirtualKeyboardProvider `onChange` when `visualViewport` is undefined — the environment does not expose the VisualViewport API needed to observe keyboard-driven viewport changes, so keyboard-change notifications cannot be delivered to subscribers.
Source
Thrown at packages/frontend/apps/mobile/src/app.tsx:106
HEAVY: [30],
}[style];
const result = navigator.vibrate?.(pattern);
if (!result) {
console.warn('vibrate not supported, or user not interacted');
}
resolve();
});
},
notification: () => Promise.reject('Not supported'),
vibrate: () => Promise.reject('Not supported'),
selectionStart: () => Promise.reject('Not supported'),
selectionChanged: () => Promise.reject('Not supported'),
selectionEnd: () => Promise.reject('Not supported'),
});
framework.impl(VirtualKeyboardProvider, {
onChange: callback => {
if (!visualViewport) {
console.warn('visualViewport is not supported');
return () => {};
}
const listener = () => {
if (!visualViewport) return;
const windowHeight = window.innerHeight;
/**
* ┌───────────────┐ - window top
* │ │
* │ │
* │ │
* │ │
* │ │
* └───────────────┘ - keyboard top --
* │ │ │ keyboard height in layout viewport
* └───────────────┘ - page(html) bottom --
* │ │ │ visualViewport.offsetTopView on GitHub (pinned to b4c8548c09)
Solutions
- Feature-detect visualViewport before use.
- Provide a non-viewport fallback layout.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Triggered on mobile when window.visualViewport is unavailable, so the virtual keyboard listener cannot be registered and a no-op unsubscribe is returned.
Common situations: Occurs in browsers lacking the VisualViewport API (older WebViews). Keyboard-aware layout adjustments will not work; upgrade the browser/WebView if needed.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/184d08cac9580e89.
Report an issue: GitHub.