From 8e8e6f9ed100701ca9e7812c679a605c7c2ce757 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 25 Feb 2026 20:15:07 +0200 Subject: [PATCH] fix(mobile/text): floating toolbar mispositioned on iOS --- .../widgets/type_widgets/text/mobile_editor_toolbar.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/client/src/widgets/type_widgets/text/mobile_editor_toolbar.tsx b/apps/client/src/widgets/type_widgets/text/mobile_editor_toolbar.tsx index 063f500574..1ab9172735 100644 --- a/apps/client/src/widgets/type_widgets/text/mobile_editor_toolbar.tsx +++ b/apps/client/src/widgets/type_widgets/text/mobile_editor_toolbar.tsx @@ -68,8 +68,12 @@ export default function MobileEditorToolbar({ inPopupEditor }: MobileEditorToolb function usePositioningOniOS(enabled: boolean, wrapperRef: MutableRef) { const adjustPosition = useCallback(() => { if (!wrapperRef.current) return; - const bottom = window.innerHeight - (window.visualViewport?.height || 0); - wrapperRef.current.style.bottom = `${bottom}px`; + const viewport = window.visualViewport; + if (!viewport) return; + // Account for both viewport height and its offset within the layout viewport, + // which includes the Safari dynamic address bar height and any page scroll. + const bottom = window.innerHeight - viewport.height - viewport.offsetTop; + wrapperRef.current.style.bottom = `${Math.max(0, bottom)}px`; }, [ wrapperRef ]); useEffect(() => {