From c37678f3bb36af2e09940392965e10ed5f7c2152 Mon Sep 17 00:00:00 2001 From: Vlad Piersec Date: Mon, 11 Oct 2021 14:36:57 +0300 Subject: [PATCH] fix(polls): Keep the original height for options when moving it up and down --- react/features/polls/components/web/PollCreate.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/react/features/polls/components/web/PollCreate.js b/react/features/polls/components/web/PollCreate.js index 81875bb81..49c50a89d 100644 --- a/react/features/polls/components/web/PollCreate.js +++ b/react/features/polls/components/web/PollCreate.js @@ -116,6 +116,13 @@ const PollCreate = (props: AbstractProps) => { const [ grabbing, setGrabbing ] = useState(null); + const interchangeHeights = (i, j) => { + const h = answerInputs.current[i].scrollHeight; + + answerInputs.current[i].style.height = `${answerInputs.current[j].scrollHeight}px`; + answerInputs.current[j].style.height = `${h}px`; + }; + const onGrab = useCallback((i, ev) => { if (ev.button !== 0) { return; @@ -131,6 +138,7 @@ const PollCreate = (props: AbstractProps) => { }); const onMouseOver = useCallback(i => { if (grabbing !== null && grabbing !== i) { + interchangeHeights(i, grabbing); moveAnswer(grabbing, i); setGrabbing(i); }