Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
chore(ios): revert virtual keyboard animations (#5775)
Peter Chinmand7a918d7c139
diff --git a/apps/web/src/components/app/useAppSquishHandlers.ts b/apps/web/src/components/app/useAppSquishHandlers.tsindex a2b4e5b661..e590c6c3c0 100644--- a/apps/web/src/components/app/useAppSquishHandlers.ts+++ b/apps/web/src/components/app/useAppSquishHandlers.ts@@ -2,7 +2,6 @@ import { isNativeMobilePlatform } from '@core/mobile/isNativeMobilePlatform';import {setVirtualKeyboardHeight,setVirtualKeyboardVisible,- type VirtualKeyboardEvent,virtualKeyboardVisible,} from '@core/mobile/virtualKeyboard';import { isEditableInput } from '@core/util/isEditableInput';@@ -11,37 +10,22 @@ import { onCleanup, onMount } from 'solid-js';const ACTIVE_ELEMENT_POLL_INTERVAL_MS = 1000;-/** Approximation of UIKit's private keyboard animation curve. */-const IOS_KEYBOARD_EASING = 'cubic-bezier(0.38, 0.7, 0.125, 1)';-/**- * Register the squish properties as typed lengths so CSS transitions can- * interpolate them — unregistered custom properties are not interpolable.- * Native-app only: a registered property's initial value permanently replaces- * the `var(--dvh, 1dvh)` fallbacks that the plain web build relies on, and- * only the native branch sets the properties inline before first paint.- * Returns whether the properties are animatable.+ * A `keyboardWillShow` / `keyboardWillHide` event as dispatched by the native+ * virtual keyboard bridge. `detail` is native-supplied, so it is read+ * defensively rather than trusted: it is absent on hide, and `CustomEvent`+ * leaves it `null` whenever the dispatcher omits it.*/-function registerSquishAnimationProperties(): boolean {- if (- typeof CSS === 'undefined' ||- typeof CSS.registerProperty !== 'function'- ) {- return false;- }- for (const name of ['--dvh', '--virtual-keyboard-height']) {- try {- CSS.registerProperty({- name,- syntax: '<length>',- inherits: true,- initialValue: '0px',- });- } catch {- // Already registered (HMR re-run) — still animatable.- }+type VirtualKeyboardEvent = CustomEvent<{+ height?: number;+ duration?: number;+} | null>;++declare global {+ interface WindowEventMap {+ keyboardWillShow: VirtualKeyboardEvent;+ keyboardWillHide: VirtualKeyboardEvent;}- return true;}function getViewportHeight() {@@ -91,31 +75,9 @@ function createActiveElementPolling(onActiveElementLost: () => void) {*/export function useAppSquishHandlers() {if (isNativeMobilePlatform()) {- const animatable = registerSquishAnimationProperties();-- /**- * Transition the squish properties over the keyboard's own animation- * duration so the layout tracks the keyboard sliding in/out. A duration- * of 0 clears the transition so the next property change applies- * instantly (non-keyboard resets must not replay the last animation).- */- const setSquishTransition = (durationSeconds: number) => {- const style = document.documentElement.style;- const durationMs = animatable ? Math.round(durationSeconds * 1000) : 0;- if (durationMs <= 0) {- style.removeProperty('transition');- return;- }- style.setProperty(- 'transition',- `--dvh ${durationMs}ms ${IOS_KEYBOARD_EASING}, --virtual-keyboard-height ${durationMs}ms ${IOS_KEYBOARD_EASING}`- );- };-let activeElementPolling: ReturnType<typeof createActiveElementPolling>;function resetNativeVirtualKeyboardState() {- setSquishTransition(0);activeElementPolling.stop();resetVirtualKeyboardState();}@@ -126,24 +88,20 @@ export function useAppSquishHandlers() {const handleKeyboardWillShow = (event: VirtualKeyboardEvent) => {activeElementPolling.start();- const keyboardHeight = event.detail?.height ?? 0;const newViewportHeight =- (window.visualViewport?.height ?? 0) - keyboardHeight;+ (window.visualViewport?.height ?? 0) - (event.detail?.height ?? 0);const dvh = newViewportHeight * 0.01;- setSquishTransition(event.detail?.duration ?? 0);document.documentElement.style.setProperty('--dvh', `${dvh}px`);document.documentElement.style.setProperty('--virtual-keyboard-height',- `${keyboardHeight}px`+ `${event.detail?.height ?? 0}px`);setVirtualKeyboardVisible(true);- setVirtualKeyboardHeight(keyboardHeight);+ setVirtualKeyboardHeight(event.detail?.height ?? 0);};- const handleKeyboardWillHide = (event: VirtualKeyboardEvent) => {- setSquishTransition(event.detail?.duration ?? 0);- activeElementPolling.stop();- resetVirtualKeyboardState();+ const handleKeyboardWillHide = () => {+ resetNativeVirtualKeyboardState();};const handleVisibilityChange = () => {@@ -167,7 +125,6 @@ export function useAppSquishHandlers() {onCleanup(() => {activeElementPolling.stop();- document.documentElement.style.removeProperty('transition');window.removeEventListener('keyboardWillShow', handleKeyboardWillShow);window.removeEventListener('keyboardWillHide', handleKeyboardWillHide);document.removeEventListener(diff --git a/apps/web/src/lib/core/mobile/virtualKeyboard.ts b/apps/web/src/lib/core/mobile/virtualKeyboard.tsindex dedf55ee05..4a832e53fc 100644--- a/apps/web/src/lib/core/mobile/virtualKeyboard.ts+++ b/apps/web/src/lib/core/mobile/virtualKeyboard.ts@@ -1,16 +1,5 @@import { createSignal } from 'solid-js';-/**- * Detail payload of the native `keyboardWillShow`/`keyboardWillHide`- * CustomEvents dispatched by tauri-plugin-virtual-keyboard. `duration` is the- * keyboard animation duration in seconds (UIKit's- * keyboardAnimationDurationUserInfoKey); `height` is absent on hide.- */-export type VirtualKeyboardEvent = CustomEventInit<{- height?: number;- duration: number;-}>;-export const [virtualKeyboardVisible, setVirtualKeyboardVisible] =createSignal(false);