Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

fix: Position text editor absolute and fix the offsets so it doesn't remain fixed when container is scrolled (#3200)

Aakansha Doshi3a0a638a0d79
diff --git a/src/components/App.tsx b/src/components/App.tsx
index dfb77b3197..ad139e9c01 100644
--- a/src/components/App.tsx
+++ b/src/components/App.tsx
@@ -1578,7 +1578,10 @@ class App extends React.Component<ExcalidrawProps, AppState> {
},
this.state,
);
- return [viewportX, viewportY];
+ return [
+ viewportX - this.state.offsetLeft,
+ viewportY - this.state.offsetTop,
+ ];
},
onChange: withBatchedUpdates((text) => {
updateElement(text);
diff --git a/src/element/textWysiwyg.tsx b/src/element/textWysiwyg.tsx
index 5173b29cd4..f219334048 100644
--- a/src/element/textWysiwyg.tsx
+++ b/src/element/textWysiwyg.tsx
@@ -93,7 +93,7 @@ export const textWysiwyg = ({
editable.wrap = "off";
Object.assign(editable.style, {
- position: "fixed",
+ position: "absolute",
display: "inline-block",
minHeight: "1em",
backfaceVisibility: "hidden",
diff --git a/src/packages/excalidraw/CHANGELOG.md b/src/packages/excalidraw/CHANGELOG.md
index b4e96484b9..7b3b4b587c 100644
--- a/src/packages/excalidraw/CHANGELOG.md
+++ b/src/packages/excalidraw/CHANGELOG.md
@@ -18,7 +18,8 @@ Please add the latest change on the top under the correct section.
### Fixes
-- Scope css variables so that host css vars don't clash with excalidraw[#3199](https://github.com/excalidraw/excalidraw/pull/3199).
+- Position text editor absolute and fix the offsets so it doesn't remain fixed when the container is scrolled [#3200](https://github.com/excalidraw/excalidraw/pull/3200).
+- Scope CSS variables so that host CSS vars don't clash with excalidraw [#3199](https://github.com/excalidraw/excalidraw/pull/3199).
---