Skip to content

Commit bc9b189

Browse files
qualitymanifestVilém Jeniš
authored andcommitted
Fix scroll behavior when node has tab chars (facebookarchive#2256)
Summary: Closes facebookarchive#2254 Problem behavior and reasoning behind solution is described in the issue. The linter issues are unrelated to the file I changed so I left them alone in order to keep this commit atomic. Pull Request resolved: facebookarchive#2256 Reviewed By: claudiopro Differential Revision: D18734244 Pulled By: mrkev fbshipit-source-id: eb5a1a91f7c3f27fced1e37f5822bc3e126fb332
1 parent c5c563f commit bc9b189

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

src/component/handlers/edit/editOnBeforeInput.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -155,29 +155,6 @@ function editOnBeforeInput(
155155
editor._latestCommittedEditorState,
156156
);
157157
}
158-
if (!mustPreventNative) {
159-
// Chrome will also split up a node into two pieces if it contains a Tab
160-
// char, for no explicable reason. Seemingly caused by this commit:
161-
// https://chromium.googlesource.com/chromium/src/+/013ac5eaf3%5E%21/
162-
163-
// in test environment, e.target is not available
164-
const nativeSelection = (e.currentTarget
165-
? e.currentTarget.ownerDocument.defaultView
166-
: global
167-
).getSelection();
168-
// Selection is necessarily collapsed at this point due to earlier check.
169-
if (
170-
nativeSelection.anchorNode &&
171-
nativeSelection.anchorNode.nodeType === Node.TEXT_NODE
172-
) {
173-
// See isTabHTMLSpanElement in chromium EditingUtilities.cpp.
174-
const parentNode = nativeSelection.anchorNode.parentNode;
175-
mustPreventNative =
176-
parentNode.nodeName === 'SPAN' &&
177-
parentNode.firstChild.nodeType === Node.TEXT_NODE &&
178-
parentNode.firstChild.nodeValue.indexOf('\t') !== -1;
179-
}
180-
}
181158
if (!mustPreventNative) {
182159
// Let's say we have a decorator that highlights hashtags. In many cases
183160
// we need to prevent native behavior and rerender ourselves --

0 commit comments

Comments
 (0)