Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(ImgViewer): Enables Modal to be closed even when `Modal.Body` is clicked

haitaoo2cb0468605af
diff --git a/ui/src/hooks/useImgViewer/index.tsx b/ui/src/hooks/useImgViewer/index.tsx
index 09a6a21d..0457694e 100644
--- a/ui/src/hooks/useImgViewer/index.tsx
+++ b/ui/src/hooks/useImgViewer/index.tsx
@@ -55,13 +55,11 @@ const useImgViewer = () => {
scrollable
contentClassName="bg-transparent"
onHide={onClose}>
- <Modal.Body>
- {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions */}
+ <Modal.Body onClick={onClose}>
<img
className="cursor-zoom-out img-fluid position-absolute top-50 start-50 translate-middle"
src={imgSrc}
alt={imgSrc}
- onClick={onClose}
/>
</Modal.Body>
</Modal>,