Skip to content

Commit

Permalink
Tweak the closeWithBackPressed method to use main thread to request f…
Browse files Browse the repository at this point in the history
…ocus
  • Loading branch information
isaac-udy committed Oct 19, 2023
1 parent d68038f commit 0581400
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class UnboundBottomSheetRobot(
// on API 30 Espresso seems to fail to call "pressBack" unless the fragment's View is
// manually requested for focus. This does not occur on API 23, 27 or 33. I believe this
// is a bug in Espresso/API 30 specifically.
fragment.requireView().requestFocus()
composeRule.runOnUiThread {
fragment.requireView().requestFocus()
}
// dirty hack to wait for the focus to come through, because waiting for
// requireView().isFocused isn't working
Thread.sleep(1000)
Expand Down

0 comments on commit 0581400

Please sign in to comment.