New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dialog is dismissed on screen touch #41178
Comments
This behavior is not consistent also w.r.t. iOS. There is not a single app (even Google ones) which dismisses modals on tap down. This problem has been worsened even more after #36956. It's now impossible to dismiss modals if another gesture recognizer participates in the arena, as the cc @dkwingsmt, author of the PR |
Sorry for causing the trouble. @audkar Is this something new to Android 10? I've tested this on several apps on earlier Android versions and it seems to me that those dialogs are closed on tap down. (I don't have Android 10 devices to test on for now.) Are dialogs dismissed on tap up even when not competing with back navigation (for example, when gesture navigation is off), and are they still cancelable? @sroddy Rejecting gestures is definitely a bug that I should fix. Thanks for bringing this up. |
This is not true |
@audkar I built the following example that contains nothing but a dialog, and tested on a Pixel running Android 9. I confirm that the dialog is dismissed on tap down instead of tap up. package com.example.testdialog
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
import android.app.AlertDialog
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)
fab.setOnClickListener { _ ->
showDialog()
}
}
private fun showDialog() {
val alertDialog = AlertDialog.Builder(this).create()
alertDialog.setTitle("Alert")
alertDialog.setMessage("Alert message to be shown")
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK") { dialog, _ ->
dialog.dismiss()
}
alertDialog.show()
}
} Your experience of dismiss on tap up might be a result of gesture competence: when another gesture is competing with the modal barrier, the tap gesture won't claim victory until all other competitors leave the arena when pointer is up. With this conclusion I'll leave the Android behavior as tap down. Nevertheless, the modal barrier should compete with the gesture navigator on Android 10, resulting in dismissing on tap up. I'll see if I can find a fix. |
Seems that this behavior is different on android 10. I can reproduce that
|
@audkar Thank you very much. It's very important. Let me discuss with others and see how we handle this. |
showDialog( |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Flutter dialog are closed immediately on screen touch. Android native behavior is different. User can touch screen and swipe away to abort dialog dismissal. Problem becomes very visible when using flutter dialogs with android 10 gestural navigation
Steps to Reproduce
Logs
The text was updated successfully, but these errors were encountered: