diff --git a/lib/features/composer/presentation/composer_controller.dart b/lib/features/composer/presentation/composer_controller.dart index 983822d83..8ad2bf57d 100644 --- a/lib/features/composer/presentation/composer_controller.dart +++ b/lib/features/composer/presentation/composer_controller.dart @@ -211,6 +211,7 @@ class ComposerController extends BaseController StreamSubscription? _subscriptionOnDragOver; StreamSubscription? _subscriptionOnDragLeave; StreamSubscription? _subscriptionOnDrop; + StreamSubscription? _subscriptionOnBlur; StreamSubscription? _composerCacheListener; RichTextMobileTabletController? richTextMobileTabletController; @@ -325,6 +326,7 @@ class ComposerController extends BaseController _subscriptionOnDragOver?.cancel(); _subscriptionOnDragLeave?.cancel(); _subscriptionOnDrop?.cancel(); + _subscriptionOnBlur?.cancel(); subjectEmailInputFocusNode?.removeListener(_subjectEmailInputFocusListener); _composerCacheListener?.cancel(); _beforeReconnectManager.removeListener(onBeforeReconnect); @@ -465,6 +467,11 @@ class ComposerController extends BaseController mailboxDashBoardController.localFileDraggableAppState.value = DraggableAppState.inActive; } }); + + // https://github.com/flutter/flutter/issues/155265#issuecomment-2417101524 + _subscriptionOnBlur = html.window.onBlur.listen((event) { + html.document.activeElement?.blur(); + }); } Future _saveComposerCacheOnWebAction() async { diff --git a/lib/features/composer/presentation/controller/rich_text_web_controller.dart b/lib/features/composer/presentation/controller/rich_text_web_controller.dart index d83c94631..a62993140 100644 --- a/lib/features/composer/presentation/controller/rich_text_web_controller.dart +++ b/lib/features/composer/presentation/controller/rich_text_web_controller.dart @@ -63,10 +63,12 @@ class RichTextWebController extends GetxController { _updateBackgroundTextColor(settings); _updateOrderList(settings); _updateParagraph(settings); + editorController.setFocus(); } void onEditorTextSizeChanged(int? size) { _updateFontSize(size); + editorController.setFocus(); } void _updateTextStyle(EditorSettings settings) {