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): Make `ImgViewer` clickable to close the image

haitaoof89687d021cd
diff --git a/ui/src/components/ImgViewer/index.tsx b/ui/src/components/ImgViewer/index.tsx
index eceb45b4..db100e4b 100644
--- a/ui/src/components/ImgViewer/index.tsx
+++ b/ui/src/components/ImgViewer/index.tsx
@@ -66,8 +66,13 @@ const Index: FC<{
contentClassName="bg-transparent"
onHide={onClose}>
<Modal.Body onClick={onClose} className="img-viewer p-0 d-flex">
+ {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions */}
<img
className="cursor-zoom-out img-fluid m-auto"
+ onClick={(evt) => {
+ evt.stopPropagation();
+ onClose();
+ }}
src={imgSrc}
alt={imgSrc}
/>