Skip to content

Commit b803bbc

Browse files
katiekleinkatiegoines
andauthored
close modal when click outside modal (#7969)
Co-authored-by: katiegoines <[email protected]>
1 parent 0c47b2f commit b803bbc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/ApiDocs/display/ApiModal.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ export const ApiModal = ({
8484
}, [] as TypeLinkInterface[])
8585
: [];
8686

87+
if (typeof window != 'undefined') {
88+
window.onclick = function (event) {
89+
if (event.target.className.includes('api-modal-container--open')) {
90+
closeModal();
91+
}
92+
};
93+
}
94+
8795
return (
8896
<View
8997
aria-label={`${name} API Reference`}

0 commit comments

Comments
 (0)