Skip to content

Commit a21ea6f

Browse files
committed
Improve positioning of context menu hack
It sometimes went wrong due to the textarea wrapper being moved when the cursor was placed under the mouse.
1 parent adb4ad3 commit a21ea6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/input/TextareaInput.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ export default class TextareaInput {
275275
operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll)
276276

277277
let oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText
278-
input.wrapper.style.cssText = "position: absolute"
279-
let wrapperBox = input.wrapper.getBoundingClientRect()
278+
let wrapperBox = input.wrapper.offsetParent.getBoundingClientRect()
279+
input.wrapper.style.cssText = "position: static"
280280
te.style.cssText = `position: absolute; width: 30px; height: 30px;
281281
top: ${e.clientY - wrapperBox.top - 5}px; left: ${e.clientX - wrapperBox.left - 5}px;
282282
z-index: 1000; background: ${ie ? "rgba(255, 255, 255, .05)" : "transparent"};

0 commit comments

Comments
 (0)