Skip to content

Commit 1952e52

Browse files
authored
[auth] Fix key binding for search focus on mac (#4584)
## Description ## Tests
2 parents aea531e + c5019da commit 1952e52

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

auth/lib/ui/home_page.dart

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,18 @@ class _HomePageState extends State<HomePage> {
116116
bool _handleKeyEvent(KeyEvent event) {
117117
if (event is KeyDownEvent) {
118118
_pressedKeys.add(event.logicalKey);
119-
if ((_pressedKeys.contains(LogicalKeyboardKey.controlLeft) ||
119+
bool isMetaKeyPressed = Platform.isMacOS || Platform.isIOS
120+
? (_pressedKeys.contains(LogicalKeyboardKey.metaLeft) ||
121+
_pressedKeys.contains(LogicalKeyboardKey.meta) ||
122+
_pressedKeys.contains(LogicalKeyboardKey.metaRight))
123+
: (_pressedKeys.contains(LogicalKeyboardKey.controlLeft) ||
120124
_pressedKeys.contains(LogicalKeyboardKey.control) ||
121-
_pressedKeys.contains(LogicalKeyboardKey.controlRight)) &&
122-
event.logicalKey == LogicalKeyboardKey.keyF) {
125+
_pressedKeys.contains(LogicalKeyboardKey.controlRight));
126+
127+
if (isMetaKeyPressed && event.logicalKey == LogicalKeyboardKey.keyF) {
123128
setState(() {
124129
_showSearchBox = true;
125130
searchBoxFocusNode.requestFocus();
126-
_textController.clear();
127-
_searchText = "";
128131
});
129132
return true;
130133
}

auth/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: ente_auth
22
description: ente two-factor authenticator
3-
version: 4.2.2+422
3+
version: 4.2.3+423
44
publish_to: none
55

66
environment:

0 commit comments

Comments
 (0)