[ACS-10319] SR: Personal files: Focus returns to input field instead of remaining on Copy link button (#11272)

This commit is contained in:
dominikiwanekhyland
2025-10-20 11:32:29 +02:00
committed by GitHub
parent 9fc7c22e18
commit 9b17f50401
2 changed files with 0 additions and 6 deletions
@@ -47,15 +47,11 @@ describe('ClipboardService', () => {
it('should copy text to clipboard', () => {
spyOn(navigator.clipboard, 'writeText');
spyOn(inputElement, 'select');
spyOn(inputElement, 'setSelectionRange');
inputElement.value = 'some text';
clipboardService.copyToClipboard(inputElement);
expect(inputElement.select).toHaveBeenCalledWith();
expect(inputElement.setSelectionRange).toHaveBeenCalledWith(0, inputElement.value.length);
expect(navigator.clipboard.writeText).toHaveBeenCalledWith('some text');
});
@@ -45,8 +45,6 @@ export class ClipboardService {
copyToClipboard(target: HTMLInputElement | HTMLTextAreaElement, message?: string) {
if (this.isTargetValid(target)) {
try {
target.select();
target.setSelectionRange(0, target.value.length);
if (navigator.clipboard) {
navigator.clipboard.writeText(target.value);
} else {