Remove enableUserSelectHack, set to false by default

Open
#709 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
javascript
Domain
frontend

Research direction

Start with lib/DraggableCore.js around line 97 and lib/utils/domFns.js around line 168 to understand how enableUserSelectHack is defined and consumed. Done means the hack is removed or defaults to false without clearing the user's document selection; verify the Gmail compose reproduction described in the issue.

Written by the indexing model from the issue text.

Description

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

Dominant language
JavaScript
Stars
9.3k
Forks
1k
Avg merge
3d 8h
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-grid-layout/react-draggable

All issues in react-grid-layout/react-draggable

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.