Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): close image preview on clicks beside a small image

Justin Willhite080f4fd653be
diff --git a/apps/web/src/components/activity/comment-editor.tsx b/apps/web/src/components/activity/comment-editor.tsx
index c80da4a26..a6192d6de 100644
--- a/apps/web/src/components/activity/comment-editor.tsx
+++ b/apps/web/src/components/activity/comment-editor.tsx
@@ -1819,12 +1819,12 @@ export default function CommentEditor({
}}
>
<DialogPopup
- className="max-w-6xl border-0 bg-transparent p-0 shadow-none before:hidden"
+ className="w-auto max-w-6xl border-0 bg-transparent p-0 shadow-none before:hidden"
showCloseButton={false}
bottomStickOnMobile={false}
>
{previewImage && (
- <div className="flex max-h-[90vh] items-center justify-center p-4">
+ <div className="flex max-h-[90vh] items-center justify-center">
<img
src={previewImage.src}
alt={previewImage.alt}
diff --git a/apps/web/src/components/task/task-description.test.tsx b/apps/web/src/components/task/task-description.test.tsx
index 4c2157c31..3d00c0d12 100644
--- a/apps/web/src/components/task/task-description.test.tsx
+++ b/apps/web/src/components/task/task-description.test.tsx
@@ -329,4 +329,28 @@ describe("TaskDescription", () => {
expect(container.textContent).toContain("parent body");
expect(container.textContent).not.toContain("child body");
});
+ // A full-width transparent popup swallows clicks beside a small image (#2174).
+ it("shrinks the image preview popup to the image (#2174)", async () => {
+ mocks.tasks.set("image-task", {
+ id: "image-task",
+ description: "![shot](https://example.com/shot.png)",
+ });
+
+ const { container } = render(<TaskDescription taskId="image-task" />);
+ const image = await waitFor(() => {
+ const found = container.querySelector("img.kaneo-editor-image");
+ expect(found).not.toBeNull();
+ return found as HTMLImageElement;
+ });
+
+ fireEvent.click(image);
+
+ const popup = await waitFor(() => {
+ const found = document.querySelector('[data-slot="dialog-popup"]');
+ expect(found).not.toBeNull();
+ return found as HTMLElement;
+ });
+ expect(popup.className).toContain("w-auto");
+ expect(popup.className).not.toContain("w-full");
+ });
});
diff --git a/apps/web/src/components/task/task-description.tsx b/apps/web/src/components/task/task-description.tsx
index 34e74afa2..9cfc0b00f 100644
--- a/apps/web/src/components/task/task-description.tsx
+++ b/apps/web/src/components/task/task-description.tsx
@@ -1776,12 +1776,12 @@ export default function TaskDescription({ taskId }: TaskDescriptionProps) {
}}
>
<DialogPopup
- className="max-w-6xl border-0 bg-transparent p-0 shadow-none before:hidden"
+ className="w-auto max-w-6xl border-0 bg-transparent p-0 shadow-none before:hidden"
showCloseButton={false}
bottomStickOnMobile={false}
>
{previewImage && (
- <div className="flex max-h-[90vh] items-center justify-center p-4">
+ <div className="flex max-h-[90vh] items-center justify-center">
<img
src={previewImage.src}
alt={previewImage.alt}