Fix room input for virtual keyboard on webkit (#2346)
authorJaggar <18173108+GigiaJ@users.noreply.github.com>
Tue, 5 Aug 2025 13:04:21 +0000 (13:04 +0000)
committerGitHub <noreply@github.com>
Tue, 5 Aug 2025 13:04:21 +0000 (23:04 +1000)
* Slate style has certain behavior elements that iOS expects

* Swap to using that implementation

src/app/components/editor/Editor.css.ts
src/app/components/editor/Editor.tsx

index 09a444ec182b645602683a79891dca57cd6102c8..d128ed07461bd57ee202805c8ece06424e47021a 100644 (file)
@@ -41,21 +41,21 @@ export const EditorTextarea = style([
   },
 ]);
 
-export const EditorPlaceholder = style([
+export const EditorPlaceholderContainer = style([
   DefaultReset,
   {
-    position: 'absolute',
-    zIndex: 1,
-    width: '100%',
     opacity: config.opacity.Placeholder,
     pointerEvents: 'none',
     userSelect: 'none',
+  },
+]);
 
-    selectors: {
-      '&:not(:first-child)': {
-        display: 'none',
-      },
-    },
+export const EditorPlaceholderTextVisual = style([
+  DefaultReset,
+  {
+    display: 'block',
+    paddingTop: toRem(13),
+    paddingLeft: toRem(1),
   },
 ]);
 
index 044d083793eaecc79aebfcf8d413a548fbc6020d..bd848dd5a382483ad8bed68f0bd9a1ace811ef22 100644 (file)
@@ -106,22 +106,17 @@ export const CustomEditor = forwardRef<HTMLDivElement, CustomEditorProps>(
       [editor, onKeyDown]
     );
 
-    const renderPlaceholder = useCallback(({ attributes, children }: RenderPlaceholderProps) => {
-      // drop style attribute as we use our custom placeholder css.
-      // eslint-disable-next-line @typescript-eslint/no-unused-vars
-      const { style, ...props } = attributes;
-      return (
-        <Text
-          as="span"
-          {...props}
-          className={css.EditorPlaceholder}
-          contentEditable={false}
-          truncate
-        >
-          {children}
-        </Text>
-      );
-    }, []);
+    const renderPlaceholder = useCallback(
+      ({ attributes, children }: RenderPlaceholderProps) => (
+        <span {...attributes} className={css.EditorPlaceholderContainer}>
+          {/* Inner component to style the actual text position and appearance */}
+          <Text as="span" className={css.EditorPlaceholderTextVisual} truncate>
+            {children}
+          </Text>
+        </span>
+      ),
+      []
+    );
 
     return (
       <div className={css.Editor} ref={ref}>