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

Fix #2698, disable selection after a scroll event when the mouseup is… #2726

Merged
merged 1 commit into from
Apr 26, 2017

Conversation

ianb
Copy link
Contributor

@ianb ianb commented Apr 21, 2017

… in the scroll area

@dannycoates
Copy link
Contributor

i can still trigger the bug... looking into why

@dannycoates
Copy link
Contributor

On my mac with "magic" scrollbars I need to scroll a bit to get the bar to show up, but once I do I seem to be lingering over the scrollbar for more than a second before I mousedown which causes me to be over SCROLLBAR_SCROLL_TIME_LIMIT.

When I set scrollbars to be always on, I get the selection behavior in the "normal" case as well, i.e. the first scroll movement is after I mousedown on the scrollbar, which seems like it'd be more normal on Windows.

This patch improves on the current result for some cases, but it seems like the (most?) common usage of this (IMHO outmoded) scrolling behavior still results in the undesired selector.

I personally would rather WONTFIX because it seems really difficult to do conclusively but I'm ok with this minor improvement too.

@ianb
Copy link
Contributor Author

ianb commented Apr 24, 2017

Increasing SCROLLBAR_SCROLL_TIME_LIMIT would seem fine to me. It's a heuristic to be sure, but it's also fairly harmless – it basically makes the very right part of the screen inactive for a period after scrolling.

@dannycoates
Copy link
Contributor

With scrollbars set always visible:

  1. click screenshot button
  2. click scrollbar and drag down
  3. release scrollbar and move left
  4. selector appears

spinner

@jaredhirsch
Copy link
Member

Rather than use a timeout, what if we just disable the next mouseup when a mousedown is detected to the right of the body element?

@jaredhirsch
Copy link
Member

I guess it'd be slightly more complex, since the following mouseup might not land inside the browser window:

on scrollbar-mousedown,
  set ignoreNextMouseUp = true;
if the next mouse event is a mouseup, ignore it;
if the next mouse event is a mousedown, handle as normal and unset ignoreNextMouseUp

@ianb
Copy link
Contributor Author

ianb commented Apr 26, 2017

Oh, I see now, my logic was all backwards. Because mousedown triggers the action, the scroll happens after it, not before. It was only working for me because I initiate a scroll to see the scrollbars. Pondering...

After some thought, I think on Mac we should just make a dead zone on the right, and on Windows we should ignore anything that is outside of the viewport.

@ianb
Copy link
Contributor Author

ianb commented Apr 26, 2017

Redone with no timer or scroll detection, just a dead zone.

@jaredhirsch
Copy link
Member

I think this works really nicely. Let's land it 👍

@jaredhirsch jaredhirsch merged commit 9392fe3 into master Apr 26, 2017
@jaredhirsch jaredhirsch deleted the dont-select-on-scroll branch April 26, 2017 21:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants