From 0393a57b5a571c0dfc2abafa8bab56f72a8a2fe6 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 9 Feb 2020 14:49:54 +0000 Subject: [PATCH] fix submit button disabled breaking async task --- .../keybackup/_CreateKeyBackupDialog.scss | 6 ++++++ .../keybackup/CreateKeyBackupDialog.js | 19 +++++++++++-------- .../CreateSecretStorageDialog.js | 10 ++++------ 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/res/css/views/dialogs/keybackup/_CreateKeyBackupDialog.scss b/res/css/views/dialogs/keybackup/_CreateKeyBackupDialog.scss index 04ee575867..b9babd05f5 100644 --- a/res/css/views/dialogs/keybackup/_CreateKeyBackupDialog.scss +++ b/res/css/views/dialogs/keybackup/_CreateKeyBackupDialog.scss @@ -85,3 +85,9 @@ limitations under the License. flex: 1; white-space: nowrap; } + +.mx_CreateKeyBackupDialog { + details .mx_AccessibleButton { + margin: 1em 0; // emulate paragraph spacing because we can't put this button in a paragraph due to HTML rules + } +} diff --git a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js index 2d6a07ad2f..f89fb17448 100644 --- a/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js +++ b/src/async-components/views/dialogs/keybackup/CreateKeyBackupDialog.js @@ -24,6 +24,7 @@ import { scorePassword } from '../../../../utils/PasswordScorer'; import { _t } from '../../../../languageHandler'; import { accessSecretStorage } from '../../../../CrossSigningManager'; import SettingsStore from '../../../../settings/SettingsStore'; +import AccessibleButton from "../../../../components/views/elements/AccessibleButton"; const PHASE_PASSPHRASE = 0; const PHASE_PASSPHRASE_CONFIRM = 1; @@ -191,7 +192,9 @@ export default class CreateKeyBackupDialog extends React.PureComponent { }); } - _onPassPhraseNextClick = async () => { + _onPassPhraseNextClick = async (e) => { + e.preventDefault(); + // If we're waiting for the timeout before updating the result at this point, // skip ahead and do it now, otherwise we'll deny the attempt to proceed // even if the user entered a valid passphrase @@ -209,7 +212,9 @@ export default class CreateKeyBackupDialog extends React.PureComponent { } }; - _onPassPhraseConfirmNextClick = async () => { + _onPassPhraseConfirmNextClick = async (e) => { + e.preventDefault(); + if (this.state.passPhrase !== this.state.passPhraseConfirm) return; this._keyBackupInfo = await MatrixClientPeg.get().prepareKeyBackupVersion(this.state.passPhrase); @@ -289,7 +294,7 @@ export default class CreateKeyBackupDialog extends React.PureComponent { ; } - return
; } @@ -362,7 +366,7 @@ export default class CreateKeyBackupDialog extends React.PureComponent { ; } const DialogButtons = sdk.getComponent('views.elements.DialogButtons'); - return ; diff --git a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js index 12ca752421..99f91d4044 100644 --- a/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js +++ b/src/async-components/views/dialogs/secretstorage/CreateSecretStorageDialog.js @@ -413,8 +413,8 @@ export default class CreateSecretStorageDialog extends React.PureComponent { "as trusted for other users.", )}