Skip to content
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

AlertDialog is dismissed when clicking on the dialog #2581

Closed
sproctor opened this issue Dec 28, 2022 · 6 comments
Closed

AlertDialog is dismissed when clicking on the dialog #2581

sproctor opened this issue Dec 28, 2022 · 6 comments
Assignees
Labels
desktop enhancement New feature or request

Comments

@sproctor
Copy link

The background Box from AlertDialog registers gestures from the content of the dialog and closes the dialog on clicks both inside and outside of the dialog.

Adding a Modifier.onClick {} to the Surface should fix it: https://github.com/JetBrains/androidx/blob/jb-main/compose/material/material/src/desktopMain/kotlin/androidx/compose/material/DesktopAlertDialog.desktop.kt#L229

Perhaps that a better way, but that one works for me.

@dima-avdeev-jb
Copy link
Contributor

Thanks for the proposal. I will discuss it with our team.
onDismissRequest callback means that you can skip it.
If you want to close AlertDialog by clicking to some Button - you may react only at Button callback.

@dima-avdeev-jb dima-avdeev-jb added enhancement New feature or request desktop labels Dec 28, 2022
@sproctor
Copy link
Author

Clicking outside of the dialog to close it might be a behavior inherited from Android, but it seems sensible. Having a dialog accidentally close by clicking on it doesn't. Currently, onDismissRequest is unusable to me. I've imported the AlertDialog from material3 and added my above change since there is currently no AlertDialog in material3.

@dima-avdeev-jb
Copy link
Contributor

Thanks. We will discuss it.

@m-sasha
Copy link
Member

m-sasha commented Mar 11, 2023

@dima-avdeev-jb This seems to be fixed, no? Should we close the ticket?

@sproctor
Copy link
Author

I can confirm this is fixed in 1.3.1, so I'm closing it. Thanks.

@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
desktop enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants