From 499d408515801013922856aa7654c5b20dbfd835 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Fri, 12 May 2023 21:26:31 +0530 Subject: [PATCH] chore: fix super toolbar not correctly hiding on ios --- .../Plugins/MobileToolbarPlugin/MobileToolbarPlugin.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/web/src/javascripts/Components/SuperEditor/Plugins/MobileToolbarPlugin/MobileToolbarPlugin.tsx b/packages/web/src/javascripts/Components/SuperEditor/Plugins/MobileToolbarPlugin/MobileToolbarPlugin.tsx index 050ee6149..4b90ca1d4 100644 --- a/packages/web/src/javascripts/Components/SuperEditor/Plugins/MobileToolbarPlugin/MobileToolbarPlugin.tsx +++ b/packages/web/src/javascripts/Components/SuperEditor/Plugins/MobileToolbarPlugin/MobileToolbarPlugin.tsx @@ -162,7 +162,9 @@ const MobileToolbarPlugin = () => { const handleFocus = () => setIsInEditor(true) const handleBlur = (event: FocusEvent) => { const elementToBeFocused = event.relatedTarget as Node - if (toolbarRef.current?.contains(elementToBeFocused) || elementToBeFocused === backspaceButtonRef.current) { + const toolbarContainsElementToFocus = toolbarRef.current && toolbarRef.current.contains(elementToBeFocused) + const willFocusBackspaceButton = backspaceButtonRef.current && elementToBeFocused === backspaceButtonRef.current + if (toolbarContainsElementToFocus || willFocusBackspaceButton) { return } setIsInEditor(false)