Skip to content

Commit a5734c9

Browse files
committed
further simplication and bugfixing
1 parent 700b64b commit a5734c9

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/components/SuggestionsDropdown.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,16 @@ export const SuggestionsDropdown: React.FunctionComponent<SuggestionsDropdownPro
4949
const style: React.CSSProperties = {};
5050
if (
5151
suggestionsAutoplace &&
52-
top +
53-
textAreaRef.current.getBoundingClientRect().top +
54-
textAreaRef.current.ownerDocument.defaultView.pageYOffset >
55-
vh / 2
52+
top + textAreaRef.current.getBoundingClientRect().top > vh / 2
5653
)
57-
style.bottom = textAreaRef.current.offsetHeight - caret.top;
54+
style.bottom = textAreaRef.current.offsetHeight - top;
5855
else style.top = top;
5956

6057
if (
6158
suggestionsAutoplace &&
62-
left +
63-
textAreaRef.current.getBoundingClientRect().left +
64-
textAreaRef.current.ownerDocument.defaultView.pageXOffset >
65-
vw / 2
59+
left + textAreaRef.current.getBoundingClientRect().left > vw / 2
6660
)
67-
style.right = textAreaRef.current.offsetWidth - caret.left;
61+
style.right = textAreaRef.current.offsetWidth - left;
6862
else style.left = left;
6963

7064
return (

0 commit comments

Comments
 (0)