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

Page is scrollto Top after use copyFromContent #232

Open
luongngochuythanh opened this issue Feb 7, 2020 · 2 comments
Open

Page is scrollto Top after use copyFromContent #232

luongngochuythanh opened this issue Feb 7, 2020 · 2 comments

Comments

@luongngochuythanh
Copy link

luongngochuythanh commented Feb 7, 2020

I used copyFromContent function to copy a text.
But after paste text, return to page and click to anywhere, the page will scroll to Top.
This is what is used

public singleCopy(targetText) {
    if (targetText) {
      this.clipBoardService.copyFromContent(targetText);
    }
  }

Inview:

<div>
     <button class="btn btn-outline-secondary single-copy-btn"
                        (click)="singleCopy(employee['name'])">
      </button>
</div>

Chrome version: 79.0.3945.130
OS: macOS Mojave10.14.4

Does anyone have experience about this or know the way to solve this please help 🙇 ?

@maxisam
Copy link
Owner

maxisam commented Feb 7, 2020

Could you provide an example on stackblitz.com?

I think it is possible to fix that behavior by setting container to body.

<body #container>
    <button ngxClipboard [cbContent]="'target string'" [container]="container">Copy</button>
</body>

@Leandro-C-Reis
Copy link

I have a similar issue, the page was scrolling to the top after copying to clipboard and switching to another tab.

It could be solved using configure method.
ClipboardService.configure({ cleanUpAfterCopy: true })

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

No branches or pull requests

3 participants