diff --git a/lib/features/composer/presentation/composer_controller.dart b/lib/features/composer/presentation/composer_controller.dart index f5fe699e66..c48de3e76d 100644 --- a/lib/features/composer/presentation/composer_controller.dart +++ b/lib/features/composer/presentation/composer_controller.dart @@ -818,9 +818,7 @@ class ComposerController extends BaseController with DragDropFileMixin implement clearFocus(context); - if (toEmailAddressController.text.isNotEmpty - || ccEmailAddressController.text.isNotEmpty - || bccEmailAddressController.text.isNotEmpty) { + if (_isExistRecipientInputText) { _collapseAllRecipient(); _autoCreateEmailTag(); } @@ -2305,6 +2303,12 @@ class ComposerController extends BaseController with DragDropFileMixin implement } } + bool get _isExistRecipientInputText { + return toEmailAddressController.text.isNotEmpty + || ccEmailAddressController.text.isNotEmpty + || bccEmailAddressController.text.isNotEmpty; + } + Future onOpenNewTabAction() async { if (openNewTabButtonState == ButtonState.disabled) { log('ComposerController::onOpenNewTabAction: OPENING NEW TAB COMPOSER'); @@ -2312,6 +2316,13 @@ class ComposerController extends BaseController with DragDropFileMixin implement } openNewTabButtonState = ButtonState.disabled; + FocusManager.instance.primaryFocus?.unfocus(); + + if (_isExistRecipientInputText) { + _collapseAllRecipient(); + _autoCreateEmailTag(); + } + final arguments = composerArguments.value; final session = mailboxDashBoardController.sessionCurrent; final accountId = mailboxDashBoardController.accountId.value;