We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
<dialog>
1 parent 76534d1 commit a73d838Copy full SHA for a73d838
1 file changed
src/App.tsx
@@ -15,7 +15,20 @@ export default function App() {
15
16
return (
17
<div>
18
- <dialog ref={dialogRef}>
+ <dialog
19
+ ref={dialogRef}
20
+ onClick={(e) => {
21
+ const rect = e.currentTarget.getBoundingClientRect()
22
+ if (
23
+ e.clientY < rect.top ||
24
+ e.clientY > rect.bottom ||
25
+ e.clientX < rect.left ||
26
+ e.clientX > rect.right
27
+ ) {
28
+ e.currentTarget.close()
29
+ }
30
+ }}
31
+ >
32
<div className='header'>
33
<button onClick={() => dialogRef.current?.close()}>X</button>
34
</div>
0 commit comments