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

Fix backspace not working in the invite dialog #7931

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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