eckbox.checked; } } } hide() { setKeyboardAccessForNonDialogElements(true); this._cancelButton.removeEventListener("click", this); this._confirmButton.removeEventListener("click", this); this._dismissButton.removeEventListener("click", this); this._overlay.removeEventListener("click", this); this._checkbox.removeEventListener("click", this); window.removeEventListener("keydown", this); this._checkbox.checked = false; this.hidden = true; } show({ title, message, confirmButtonLabel, confirmCheckboxLabel, count }) { setKeyboardAccessForNonDialogElements(false); this.hidden = false; document.l10n.setAttributes(this._title, title, { count, }); document.l10n.setAttributes(this._message, message, { count, }); document.l10n.setAttributes(this._confirmButton, confirmButtonLabel, { count, }); document.l10n.setAttributes(this._checkboxLabel, confirmCheckboxLabel, { count, }); this._checkbox.addEventListener("click", this); this._cancelButton.addEventListener("click", this); this._confirmButton.addEventListener("click", this); this._dismissButton.addEventListener("click", this); this._overlay.addEventListener("click", this); window.addEventListener("keydown", this); this._confirmButton.disabled = true; // For speed-of-use, focus the confirmation checkbox when the dialog loads. // Introducing this checkbox provides enough of a buffer for accidental deletions. this._checkbox.focus(); this._promise = new Promise((resolve, reject) => { this._resolve = resolve; this._reject = reject; }); return this._promise; } onCancel() { this._reject(); this.hide(); } onConfirm() { this._resolve(); this.hide(); } } customElements.define("remove-logins-dialog", RemoveLoginsDialog); PK