feat(editor): deselect on esc (#11035)

Co-authored-by: Jawahar <jawahars_16@live.in>
Co-authored-by: Andrew Aquino <dawneraq@gmail.com>
This commit is contained in:
David Luzar
2026-03-25 17:14:24 +01:00
committed by GitHub
parent c1082923ee
commit c09e170bdd
9 changed files with 856 additions and 14 deletions
+6 -6
View File
@@ -5725,13 +5725,13 @@ class App extends React.Component<AppProps, AppState> {
const isDeleted = !nextOriginalText.trim();
updateElement(nextOriginalText, isDeleted);
// select the created text element only if submitting via keyboard
// (when submitting via click it should act as signal to deselect)
if (!isDeleted && viaKeyboard) {
const elementIdToSelect = element.containerId
? element.containerId
: element.id;
// keyboard-submit keeps focus on the edited object. For bound text, keep
// the container selected even if the text becomes empty and is deleted.
const elementIdToSelect = viaKeyboard
? element.containerId || (!isDeleted ? element.id : null)
: null;
if (elementIdToSelect) {
// needed to ensure state is updated before "finalize" action
// that's invoked on keyboard-submit as well
// TODO either move this into finalize as well, or handle all state