copy-to-clipboard icon indicating copy to clipboard operation
copy-to-clipboard copied to clipboard

Selection.addRange() is deprecated

Open jakubzitny opened this issue 6 years ago • 8 comments

Merging ranges is deprecated for a while now https://www.chromestatus.com/features/6680566019653632.

Removing all ranges before adding was suggested in https://stackoverflow.com/a/43443101.

jakubzitny avatar Mar 27 '18 09:03 jakubzitny

This should be handled in https://github.com/sudodoki/toggle-selection

sudodoki avatar Mar 27 '18 10:03 sudodoki

@sudodoki Just to clarify -- do you mean that this pull request does not belong in copy-to-clipboard or that this change should also be applied in toggle-selection?

rolandliwag avatar Mar 29 '18 14:03 rolandliwag

It looks like it already is in toggle-selection but I think only explicitly calling removeAllRanges() like this helped us. I will find some time to confirm / find the actual problem.

jakubzitny avatar Mar 31 '18 15:03 jakubzitny

+1 I need this change too. Doesn't work for me in some scenarios without this change. Otherwise, the user has to click twice before copying works.

mhuggins avatar Oct 25 '18 17:10 mhuggins

@sudodoki Would it be possible to add a maintainer to this repo to help get in some vital fixes like this one?

mhuggins avatar Oct 25 '18 17:10 mhuggins

@mhuggins

Doesn't work for me in some scenarios without this change. Otherwise, the user has to click twice before copying works.

can you please provide a repro case / list scenarios / investigate further. I don't think @jakubzitny wasn't able to find out the root cause, and I don't have time for it.

Would it be possible to add a maintainer to this repo to help get in some vital fixes like this one?

Sure, anyone who is willing could become one, should I add you?

sudodoki avatar Oct 25 '18 19:10 sudodoki

By https://github.com/sudodoki/copy-to-clipboard/pull/63#issuecomment-376483748 I meant that removeAllRanges is called in here https://github.com/sudodoki/toggle-selection/blob/gh-pages/index.js#L25 so this is kinda weird. Would be nice if anyone could come with env description / steps to reproduce.

sudodoki avatar Oct 26 '18 08:10 sudodoki

Any updates on this?

I get this error on my app and when I do, the text is not copied and the user has to click again.

Screen Shot 2019-12-10 at 12 02 08 PM

ATheCoder avatar Dec 10 '19 08:12 ATheCoder