Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix backspace not working in the invite dialog (#7931)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBrandner committed Mar 1, 2022
1 parent f914071 commit 928b086
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/views/dialogs/InviteDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
private onKeyDown = (e) => {
if (this.state.busy) return;

let handled = true;
let handled = false;
const value = e.target.value.trim();
const action = getKeyBindingsManager().getAccessibilityAction(e);

Expand All @@ -815,21 +815,22 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps

// when the field is empty and the user hits backspace remove the right-most target
this.removeMember(this.state.targets[this.state.targets.length - 1]);
handled = true;
break;
case KeyBindingAction.Space:
if (!value || !value.includes("@") || value.includes(" ")) break;

// when the user hits space and their input looks like an e-mail/MXID then try to convert it
this.convertFilter();
handled = true;
break;
case KeyBindingAction.Enter:
if (!value) break;

// when the user hits enter with something in their field try to convert it
this.convertFilter();
handled = true;
break;
default:
handled = false;
}

if (handled) {
Expand Down

0 comments on commit 928b086

Please sign in to comment.