Skip to content

Commit 4e50395

Browse files
authored
Hide keyboard in unfocussed state when Input Screen enabled (#6862)
Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1211370636939092?focus=true ### Description - Hides the keyboard in the unfocussed state when the Input Screen is enabled. ### Steps to test this PR _Input Screen enabled_ - [x] Create a new tab and go to a web page - [x] Go back - [x] Verify that the keyboard is not shown _Input Screen disabled_ - [x] Create a new tab and go to a web page - [x] Go back - [x] Verify that the keyboard is shown and the omnibar is focussed
1 parent 6e7a874 commit 4e50395

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

app/src/androidTest/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,6 +2632,16 @@ class BrowserTabViewModelTest {
26322632
assertTrue(commandCaptor.allValues.contains(Command.ShowKeyboard))
26332633
}
26342634

2635+
@Test
2636+
fun whenUserPressesBackAndGoesToHomeWithInputScreenEnabledThenKeyboardNotShown() {
2637+
whenever(mockDuckAiFeatureState.showInputScreen).thenReturn(MutableStateFlow(true))
2638+
2639+
setupNavigation(isBrowsing = true, canGoBack = false, skipHome = false)
2640+
testee.onUserPressedBack()
2641+
2642+
assertCommandNotIssued<ShowKeyboard>()
2643+
}
2644+
26352645
@Test
26362646
fun whenUserPressesBackOnATabWithASourceTabThenDeleteCurrentAndSelectSource() =
26372647
runTest {

app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,9 @@ class BrowserTabViewModel @Inject constructor(
14291429
}
14301430
return true
14311431
} else if (!skipHome && !isCustomTab) {
1432-
command.value = ShowKeyboard
1432+
if (!duckAiFeatureState.showInputScreen.value) {
1433+
command.value = ShowKeyboard
1434+
}
14331435
navigateHome()
14341436
return true
14351437
}

0 commit comments

Comments
 (0)