Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

holding left mouse click on scroll bar and dragging mouse pointer away from table causes scroll bars to attach to scroll evnet even left mouse click is released. #120

Closed
sameeraroshan opened this issue Mar 23, 2018 · 4 comments
Labels

Comments

@sameeraroshan
Copy link

#steps to create

  1. click and hold left mouse button on scroll bar( horizontal or vertical)
  2. drag mouse pointer away from the window (to address bar of the browser)
  3. release the left mouse button there on the address bar.
  4. drag mouse pointer to table again.
  5. scroll bar still responds as left mouse button is clicked. but ideally it should not respond to mouse movements because no mouse button is clicked on the scroll bar.
@sameeraroshan sameeraroshan changed the title holding left mouse click on scroll bar and dragging mouse pointer away from table causes scroll bars to attach to scroll evnet even left mouse is released. holding left mouse click on scroll bar and dragging mouse pointer away from table causes scroll bars to attach to scroll evnet even left mouse click is released. Mar 23, 2018
@TonyGermaneri
Copy link
Owner

You can change this behavior with the scrollPointerLock attribute.

The reason it behaves this way is due to the browser preventing any events outside of the HTML document from firing, so as soon as that mouse leaves the window, I can't detect it anymore. So mouse up events are not seen either. There is no fix for this because the behavior is intended by the W3C, but there is a workaround. W3C introduced pointer lock mode which causes the mouse cursor to disappear and return deltas for movement until the cursor is released. Because it causes the cursor to vanish I have it set as not the default, but I recognize the problem so offer at least some alternative.

@sameeraroshan
Copy link
Author

tony this can be fixed using document.addEventListener('mouseout',self.stopScrollGrid, false);
inside mousedown function

document.body.addEventListener('mousemove', self.scrollGrid, false);
document.addEventListener('mouseout',self.stopScrollGrid, false);
document.body.addEventListener('mouseup', self.stopScrollGrid, false);

it solved the above issue. you can do this to column drag, resize , etc

@TonyGermaneri
Copy link
Owner

That's great!! That was SOO annoying. Is there any way you can make a PR to fix it?

@TonyGermaneri
Copy link
Owner

Thanks again for figuring out a better work around for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants