Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions primitives/src/dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use dioxus::document;
use dioxus::prelude::*;

use crate::{
use_animated_open, use_controlled, use_global_escape_listener, use_id_or, use_outside_dismiss,
use_unique_id, FOCUS_TRAP_JS,
use_animated_open, use_controlled, use_global_escape_listener, use_id_or, use_unique_id,
FOCUS_TRAP_JS,
};

/// Context for the [`DialogRoot`] component
Expand Down Expand Up @@ -141,6 +141,7 @@ pub fn DialogRoot(props: DialogRootProps) -> Element {
id,
aria_hidden: (!open()).then_some("true"),
"data-state": if open() { "open" } else { "closed" },
onclick: move |_| set_open.call(false),
..props.attributes,
{props.children}
}
Expand Down Expand Up @@ -228,7 +229,6 @@ pub fn DialogContent(props: DialogContentProps) -> Element {
let gen_id = use_unique_id();
let id = use_id_or(gen_id, props.id);

use_outside_dismiss(id, move || set_open.call(false));
use_effect(move || {
let is_modal = is_modal();
if !is_modal {
Expand Down Expand Up @@ -261,6 +261,7 @@ pub fn DialogContent(props: DialogContentProps) -> Element {
aria_labelledby: ctx.dialog_labelledby,
aria_describedby: ctx.dialog_describedby,
class: props.class.clone().unwrap_or_else(|| "dx-dialog".to_string()),
onclick: move |evt| evt.stop_propagation(),
..props.attributes,
{props.children}
}
Expand Down
Loading