Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Quick fix for safari 'node not found' bug
Browse files Browse the repository at this point in the history
Summary:
This is a quick fix, but we will do a follow-up diff to add more precautions
and fix any other misnamed refs. Want to push this asap to fix the bug.

In a previous diff[1] we changed the syntax for getting the reference to the
editor node, but this spot was not updated.
[1]: https://our.intern.facebook.com/intern/diff/D5964582/

This introduced a bug where clicking a link caused the focus to move but the
selection state was not cleared, and this is a known issue in Safari in
particular. In the past we had a work-around in Draft, but the work-around was
no longer working due to the misnamed ref.

PS Thanks to @[578934877:sophiebits] for pairing with me and realizing the root cause of the bug. :)

Reviewed By: sophiebits

Differential Revision: D6344247

fbshipit-source-id: fb0c3f2a7264fc68319536d6c18c30a27053c0aa
  • Loading branch information
flarnie authored and facebook-github-bot committed Nov 16, 2017
1 parent c1150a7 commit 5531617
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/component/handlers/edit/editOnBlur.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function editOnBlur(editor: DraftEditor, e: SyntheticEvent<>): void {
// opposed to clicking to another tab or window).
if (getActiveElement() === document.body) {
const selection = global.getSelection();
const editorNode = editor.refs.editor;
const editorNode = editor.editor;
if (
selection.rangeCount === 1 &&
containsNode(editorNode, selection.anchorNode) &&
Expand Down

0 comments on commit 5531617

Please sign in to comment.