Merge pull request #1321 from bitwarden/chrome-clipboard-clear-space-fix

Modified Chrome to pass in null unicode on clear
This commit is contained in:
Matt Smith 2020-07-10 09:56:30 -05:00 committed by GitHub
commit 43c0669816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -207,6 +207,10 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
this.clipboardWriteCallback(text, clearMs);
}
} else if (doc.queryCommandSupported && doc.queryCommandSupported('copy')) {
if (this.isChrome() && text === '') {
text = '\u0000';
}
const textarea = doc.createElement('textarea');
textarea.textContent = text == null || text === '' ? ' ' : text;
// Prevent scrolling to bottom of page in MS Edge.