Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: for all backup import error add a try again flow #15579

Merged
merged 3 commits into from Aug 14, 2023

Conversation

arjita-mitra
Copy link
Contributor


PR Submission Checklist for internal contributors

  • The PR Title

    • If you enter invalid password for restoring conversation Backup, password dialog disappears
  • The PR Description

    • Log in to web app (Wire · The most secure collaboration platform)

      Go to Preferences

      Create backup with password

      Click ‘Restore’ button and select previously created backup file

      Enter invalid password and try to restore

      Actual outcome:
      You see ‘Wrong Password’ window. When you click ‘Cancel’ button (attachment), password dialog is gone and you have to click ‘Restore’ button again.

      Expected outcome:
      add a try again button in the wrong password modal, clicking on it should open the file picker again.


What's new in this PR?

Issues

  • restore button's whole area is not clickable, because we're essentially trying to put an interactive element (the ) inside another interactive element (the ). It's not clear which action the browser should take when there are nested interactive elements like this.

Solutions

Separate the input from the button

References
  1. https://wearezeta.atlassian.net/browse/WPB-3655

fix restire button's whole area not clickable
create re-usable backup file upload component
Comment on lines +44 to +77
const fileInputClick = () => fileInputRef.current?.click();

return (
<>
<label className="preferences-history-backup-import-field" data-uie-name="do-backup-import" id="do-backup-import">
<input
id="file-import-input"
ref={fileInputRef}
tabIndex={TabIndex.UNFOCUSABLE}
type="file"
accept={`.${HistoryExportConfig.FILE_EXTENSION}`}
onChange={onFileChange}
onFocus={({target}) => target.blur()}
data-uie-name="input-import-file"
aria-describedby="preferences-history-describe-2"
/>
</label>

<Button
variant={variant}
className={cssClassName}
role="button"
tabIndex={TabIndex.FOCUSABLE}
onKeyDown={event => handleKeyDown(event, fileInputClick)}
onClick={() => fileInputRef.current?.click()}
aria-labelledby="do-backup-import"
>
<span>{backupImportHeadLine}</span>
</Button>
</>
);
};

export {BackupFileUpload};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to extract that logic to a new component 👍

Copy link
Contributor

@atomrc atomrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arjita-mitra arjita-mitra merged commit 018fc98 into dev Aug 14, 2023
12 checks passed
@arjita-mitra arjita-mitra deleted the improvement/WPB-3655 branch August 14, 2023 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants