react-draggable
react-draggable copied to clipboard
Remove enableUserSelectHack, set to false by default
Rant: We had an incredibly difficult time connecting the dots between a setState causing a modal to hide and figuring out why the user was losing focus in Gmail. I've probably spent 10+ hours digging through our codebase since we have a ton of places where we manage the user's selection. The last thing I expected was for the Draggable wrapper on that modal to be removing all ranges from the document. I had to resort to a binary search "comment half of everything out, see if it still works, repeat" which was still extremely difficult because I didn't consider the very last element to be the one causing issues.
Repro: The user selects text in any Gmail compose window, opens formatting, clicks bold, our modal disappears (from something like document.addEventListener('mousedown', checkIsOutsideAndHideModal)
, and the user loses their selection and bold is not applied
RCA: https://github.com/react-grid-layout/react-draggable/blob/master/lib/DraggableCore.js#L97 This comment explains why it exists, but the code that consumes this flag is mostly about removing document ranges https://github.com/react-grid-layout/react-draggable/blob/master/lib/utils/domFns.js#L168