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

Prevent page scrolling on copy. #28

Closed
wants to merge 2 commits into from
Closed

Prevent page scrolling on copy. #28

wants to merge 2 commits into from

Conversation

kremerd
Copy link

@kremerd kremerd commented Apr 20, 2016

On larger pages the scrollbar will jump to the hidden node, i.e. the end of the document on node.select() - at least in IE 11. You can try it at https://plnkr.co/JMOnatFAlWrh0R53FuTu.

The fix is pretty straight-forward and working well for me.

For better cross-browser compatibility exchanged window.scrollX by window.pageXOffset as suggested by MDN (https://developer.mozilla.org/de/docs/Web/API/window/scrollX).
@omichelsen
Copy link
Owner

omichelsen commented Apr 28, 2016

I'm not a fan of hijacking the page scroll in order to copy things to clipboard. It seems hacky to me, and for something that only happens on IE/Edge.

Thanks for the PR, but first I will see if I can find another way before I merge.

@kremerd
Copy link
Author

kremerd commented Apr 30, 2016

Sure. I agree there are better ways to handle this, and opened an Issue to track the case further.

However please note that the actual hijacking is done automatically by IE, and it's unlikely that we'll be able to change that.

@dietwice
Copy link

Hi Ole,
May I ask if you had a chance to look at this issue?

Thanks in advance.

@omichelsen
Copy link
Owner

I have just released v1.4.2 with a fix for this.

@omichelsen omichelsen closed this May 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants