diff --git a/system/ui/sunnypilot/widgets/input_dialog.py b/system/ui/sunnypilot/widgets/input_dialog.py index f159047846..f532bd9fed 100644 --- a/system/ui/sunnypilot/widgets/input_dialog.py +++ b/system/ui/sunnypilot/widgets/input_dialog.py @@ -25,11 +25,11 @@ class InputDialogSP: self.keyboard.set_text(self.current_text) def internal_callback(result: DialogResult): + text = self.keyboard.text if result == DialogResult.CONFIRM else "" if result == DialogResult.CONFIRM: - text = self.keyboard.text if self.param: self._params.put(self.param, text) - if self.callback: - self.callback(result, text) + if self.callback: + self.callback(result, text) gui_app.set_modal_overlay(self.keyboard, internal_callback) diff --git a/system/ui/sunnypilot/widgets/tests/test_input_dialog.py b/system/ui/sunnypilot/widgets/tests/test_input_dialog.py index a4d21c6257..149dd3739c 100644 --- a/system/ui/sunnypilot/widgets/tests/test_input_dialog.py +++ b/system/ui/sunnypilot/widgets/tests/test_input_dialog.py @@ -13,7 +13,7 @@ class TestInputDialog: def test_input_dialog_int(self): gui_app.init_window("test window") - dialog = InputDialogSP("title", current_text="current_text", param="MapTargetVelocities") # some rando param, sorry sunny bc its your's + dialog = InputDialogSP("title", current_text="current_text", param="MapTargetVelocities") # some rando param, sorry sunny bc it's yours dialog.show() dialog.keyboard._render_return_status = 1