Skip to content

Commit

Permalink
fix(cdk/clipboard): page jumping on iOS (#25221)
Browse files Browse the repository at this point in the history
Fixes the page jump when copying to the clipboard on newer versions of iOS by making the temporary `textarea` readonly.

Fixes #25169.

(cherry picked from commit d10e7ec)
  • Loading branch information
crisbeto committed Jul 12, 2022
1 parent 4199a20 commit 938aa2f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cdk/clipboard/pending-copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export class PendingCopy {
styles.left = '-999em';
textarea.setAttribute('aria-hidden', 'true');
textarea.value = text;
// Making the textarea `readonly` prevents the screen from jumping on iOS Safari (see #25169).
textarea.readOnly = true;
this._document.body.appendChild(textarea);
}

Expand Down

0 comments on commit 938aa2f

Please sign in to comment.