Prevent backspace and delete functionality in the in-call dial pad. (#6522)

Just as one cannot do when there inputting number while
on a call on their phone, it doesn't make much sense to
be able to do so while on a call in Element. The DTMF
tone history should be preserved.
This commit is contained in:
Andrew Morgan 2021-08-02 10:18:35 +01:00 committed by GitHub
parent 442992b30e
commit 645c128e44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,6 +49,13 @@ export default class DialpadContextMenu extends React.Component<IProps, IState>
this.props.onFinished();
};
onKeyDown = (ev) => {
// Prevent Backspace and Delete keys from functioning in the entry field
if (ev.code === "Backspace" || ev.code === "Delete") {
ev.preventDefault();
}
};
onChange = (ev) => {
this.setState({ value: ev.target.value });
};
@ -64,6 +71,7 @@ export default class DialpadContextMenu extends React.Component<IProps, IState>
className="mx_DialPadContextMenu_dialled"
value={this.state.value}
autoFocus={true}
onKeyDown={this.onKeyDown}
onChange={this.onChange}
/>
</div>