Fix backspace not working in the invite dialog (#7931)
parent
f9140718b0
commit
928b086e05
|
@ -805,7 +805,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
private onKeyDown = (e) => {
|
private onKeyDown = (e) => {
|
||||||
if (this.state.busy) return;
|
if (this.state.busy) return;
|
||||||
|
|
||||||
let handled = true;
|
let handled = false;
|
||||||
const value = e.target.value.trim();
|
const value = e.target.value.trim();
|
||||||
const action = getKeyBindingsManager().getAccessibilityAction(e);
|
const action = getKeyBindingsManager().getAccessibilityAction(e);
|
||||||
|
|
||||||
|
@ -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
|
// 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]);
|
this.removeMember(this.state.targets[this.state.targets.length - 1]);
|
||||||
|
handled = true;
|
||||||
break;
|
break;
|
||||||
case KeyBindingAction.Space:
|
case KeyBindingAction.Space:
|
||||||
if (!value || !value.includes("@") || value.includes(" ")) break;
|
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
|
// when the user hits space and their input looks like an e-mail/MXID then try to convert it
|
||||||
this.convertFilter();
|
this.convertFilter();
|
||||||
|
handled = true;
|
||||||
break;
|
break;
|
||||||
case KeyBindingAction.Enter:
|
case KeyBindingAction.Enter:
|
||||||
if (!value) break;
|
if (!value) break;
|
||||||
|
|
||||||
// when the user hits enter with something in their field try to convert it
|
// when the user hits enter with something in their field try to convert it
|
||||||
this.convertFilter();
|
this.convertFilter();
|
||||||
|
handled = true;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
handled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handled) {
|
if (handled) {
|
||||||
|
|
Loading…
Reference in New Issue