fix: deselect on escape only if neither dragging nor finalizing an action

This commit is contained in:
Andrew Aquino 2024-04-03 16:06:23 -07:00
parent db9aca37b6
commit 63e748f147

View file

@ -3748,11 +3748,16 @@ class App extends React.Component<AppProps, AppState> {
}
// remove selections on escape press
if (event.key === KEYS.ESCAPE) {
// Don't deselect text right after editing it
if (isWritableElement(event.target)) {
return;
}
if (
event.key === KEYS.ESCAPE &&
// unless we're dragging or finalizing an action
!(
this.state.draggingElement ||
isWritableElement(event.target) ||
this.state.editingElement ||
["freedraw", "eraser"].includes(this.state.activeTool.type)
)
) {
this.setState({
selectedElementIds: {},
selectedGroupIds: {},