Skip to content

Commit 938aa2f

Browse files
committed
fix(cdk/clipboard): page jumping on iOS (#25221)
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)
1 parent 4199a20 commit 938aa2f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/cdk/clipboard/pending-copy.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export class PendingCopy {
3434
styles.left = '-999em';
3535
textarea.setAttribute('aria-hidden', 'true');
3636
textarea.value = text;
37+
// Making the textarea `readonly` prevents the screen from jumping on iOS Safari (see #25169).
38+
textarea.readOnly = true;
3739
this._document.body.appendChild(textarea);
3840
}
3941

0 commit comments

Comments
 (0)