soto: ignore backspace at cursor position 0

If you entered the web dojo and hit Backspace immediately,
it would still process it as a valid key but pass the whole key forward.

This adds a conditional to ignore the key in those cases.
This commit is contained in:
Matilde Park 2020-03-23 11:25:36 -04:00
parent fed93b1fe5
commit c1a4aeb60e

View File

@ -39,6 +39,8 @@ export class Input extends Component {
else if ((e.key === "Backspace") && (this.props.cursor > 0)) { else if ((e.key === "Backspace") && (this.props.cursor > 0)) {
store.doEdit({ del: this.props.cursor - 1}); store.doEdit({ del: this.props.cursor - 1});
return store.setState({ cursor: this.props.cursor - 1}); return store.setState({ cursor: this.props.cursor - 1});
} else if (e.key === "Backspace") {
return;
} }
else if (e.key.startsWith("Arrow")) { else if (e.key.startsWith("Arrow")) {