Skip to content

Commit ffe13dd

Browse files
committed
fix: fix textarea elements in ios/android can not auto unfocus.
1 parent f2db5d9 commit ffe13dd

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

scripts/build_ios_framework.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ process.env.PATCH_PROMISE_POLYFILL = 'true';
1414

1515
// Run tasks
1616
series(
17+
'ios-framework-clean',
1718
'compile-polyfill',
1819
'generate-bindings-code',
1920
'build-ios-webf-lib'

webf/lib/src/html/html.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Copyright (C) 2019-2022 The Kraken authors. All rights reserved.
33
* Copyright (C) 2022-present The WebF authors. All rights reserved.
44
*/
5-
5+
import 'package:flutter/widgets.dart' show FocusManager;
66
import 'package:flutter/rendering.dart';
77
import 'package:webf/css.dart';
88
import 'package:webf/dom.dart';
@@ -15,7 +15,12 @@ const Map<String, dynamic> _defaultStyle = {
1515
};
1616

1717
class HTMLElement extends Element {
18-
HTMLElement([BindingContext? context]) : super(context);
18+
HTMLElement([BindingContext? context]) : super(context) {
19+
// Add default behavior unfocus focused input or textarea elements.
20+
addEventListener('click', (event) async {
21+
FocusManager.instance.primaryFocus?.unfocus();
22+
});
23+
}
1924

2025
@override
2126
Map<String, dynamic> get defaultStyle => _defaultStyle;

0 commit comments

Comments
 (0)