Skip to content

Commit

Permalink
Fix #1611
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Dynamos committed Feb 24, 2024
1 parent ac55dce commit 662ee6e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kivymd/uix/dialog/dialog.py
Expand Up @@ -428,6 +428,7 @@ def on_start(self):
NumericProperty,
ColorProperty,
ObjectProperty,
BooleanProperty,
)
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.widget import Widget
Expand Down Expand Up @@ -490,6 +491,15 @@ class MDDialog(MDCard, MotionDialogBehavior):
and defaults to `[0, 0, 0, 0.5]`.
"""

auto_dismiss = BooleanProperty(True)
"""
This property determines if the dialog is automatically
dismissed when the user clicks outside it.

This comment has been minimized.

Copy link
@HeaTTheatR

HeaTTheatR Feb 24, 2024

Member

Please add a tag

..versionadded:: 2.0.0

:attr:`auto_dismiss` is a :class:`~kivy.properties.BooleanProperty` and
defaults to True.
"""

_scrim = ObjectProperty() # kivymd.uix.dialog.dialog.MDDialogScrim object
_is_open = False # is the dialog currently open or closed.

Expand Down Expand Up @@ -555,7 +565,7 @@ def on_pre_dismiss(self, *args) -> None:
"""Fired when a dialog pre-dismiss."""

def on_touch_down(self, touch):
if not self.collide_point(*touch.pos):
if not self.collide_point(*touch.pos) and self.auto_dismiss:
self.dismiss()
return True
super().on_touch_down(touch)
Expand Down

0 comments on commit 662ee6e

Please sign in to comment.