From 29080353f63855df1402781e544b7f4ce65dc9ea Mon Sep 17 00:00:00 2001 From: Ante Beslic Date: Tue, 5 Nov 2019 10:31:34 -0800 Subject: [PATCH] fixes #304, kudos to @andpor (#2197) Summary: Should fix https://github.com/facebook/draft-js/issues/304. Thanks andpor. **Summary** based on Andrzej's https://github.com/facebook/draft-js/issues/1223, issue has been there for an incredible 3.5 years. Let's fix this. Pull Request resolved: https://github.com/facebook/draft-js/pull/2197 Reviewed By: elboman Differential Revision: D18314441 Pulled By: mrkev fbshipit-source-id: 99284101bab838c574341b44b3cfcd935f1dc0e2 --- src/component/contents/DraftEditorBlock.react.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/component/contents/DraftEditorBlock.react.js b/src/component/contents/DraftEditorBlock.react.js index 8d98d1683e..75a0c057fd 100644 --- a/src/component/contents/DraftEditorBlock.react.js +++ b/src/component/contents/DraftEditorBlock.react.js @@ -126,7 +126,9 @@ class DraftEditorBlock extends React.Component { 'blockNode is not an HTMLElement', ); const blockBottom = blockNode.offsetHeight + blockNode.offsetTop; - const scrollBottom = scrollParent.offsetHeight + scrollPosition.y; + const pOffset = scrollParent.offsetTop + scrollParent.offsetHeight; + const scrollBottom = pOffset + scrollPosition.y; + scrollDelta = blockBottom - scrollBottom; if (scrollDelta > 0) { Scroll.setTop(