Skip to content

Commit bc7e251

Browse files
mrkevVilém Jeniš
authored andcommitted
Address facebookarchive#2413 by making Firefox follow the same behaviour as Chrome (facebookarchive#2414)
Summary: All info is in the facebookarchive#2413 and this [Bugzilla issue](https://bugzilla.mozilla.org/show_bug.cgi?id=1625475). Noteworthy from that Bugzilla thread is [comment 16](https://bugzilla.mozilla.org/show_bug.cgi?id=1625475#c16): > I added a selectionchange listener to the document of Twitter, and I tried reproducing this with the STR in comment 10. Then, I confirmed that selectionchange event is fired as expected both on Firefox (Nightly) and Chrome (Release) when I click middle of the text node. So, **it might be a bug of React if the onSelect is not called as expected...** This is worth future investigation, but for now let's just fix the bug. Pull Request resolved: facebookarchive#2414 Reviewed By: kedromelon Differential Revision: D21443875 Pulled By: mrkev fbshipit-source-id: 8bd099ddc44e3c4cdac679e1d605c4da5146c1e8
1 parent b45fa9d commit bc7e251

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/component/handlers/edit/DraftEditorEditHandler.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const onPaste = require('editOnPaste');
2929
const onSelect = require('editOnSelect');
3030

3131
const isChrome = UserAgent.isBrowser('Chrome');
32+
const isFirefox = UserAgent.isBrowser('Firefox');
3233

33-
const selectionHandler: (e: DraftEditor) => void = isChrome
34-
? onSelect
35-
: e => {};
34+
const selectionHandler: (e: DraftEditor) => void =
35+
isChrome || isFirefox ? onSelect : e => {};
3636

3737
const DraftEditorEditHandler = {
3838
onBeforeInput,

0 commit comments

Comments
 (0)