Skip to content

Commit af7fe50

Browse files
authored
fix: trigger close only when click wrap itself (#218)
* fix: trigger close only when click wrap itself * chore: clean code
1 parent 586bfcb commit af7fe50

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

src/Dialog/Content/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export interface ContentProps extends IDialogChildProps {
1818

1919
export interface ContentRef {
2020
focus: () => void;
21-
getDOM: () => HTMLDivElement;
2221
changeActive: (next: boolean) => void;
2322
}
2423

@@ -58,7 +57,6 @@ const Content = React.forwardRef<ContentRef, ContentProps>((props, ref) => {
5857
focus: () => {
5958
sentinelStartRef.current?.focus();
6059
},
61-
getDOM: () => dialogRef.current,
6260
changeActive: (next) => {
6361
const { activeElement } = document;
6462
if (next && activeElement === sentinelEndRef.current) {

src/Dialog/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export default function Dialog(props: IDialogChildProps) {
112112
if(contentClickRef.current) {
113113
contentClickRef.current = false;
114114
} else if (
115-
!contains(contentRef.current.getDOM(), e.target as HTMLElement)
115+
wrapperRef.current === e.target
116116
) {
117117
onInternalClose(e);
118118
}

0 commit comments

Comments
 (0)