mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Allow returning from global search with the escape key
cmd+k jumps to the search tab but left users with no way back. Pressing escape in the search field now returns to the tab they came from (never into search itself). Escape is handled at the search field's pressesBegan, alongside the existing arrow-key navigation, since the focused UIKit field swallows SwiftUI keyboard shortcuts.
This commit is contained in:
@@ -33,6 +33,8 @@ struct SearchScreenViewModelTests {
|
||||
switch action {
|
||||
case .presentRoom(let roomID):
|
||||
roomID == "2"
|
||||
case .cancel:
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,4 +42,20 @@ struct SearchScreenViewModelTests {
|
||||
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
|
||||
@Test
|
||||
func cancel() async throws {
|
||||
let deferred = deferFulfillment(viewModel.actionsPublisher) { action in
|
||||
switch action {
|
||||
case .cancel:
|
||||
true
|
||||
default:
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
context.send(viewAction: .cancel)
|
||||
|
||||
try await deferred.fulfill()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user