From fcc90e7a8766761c4dd95aa1b8c37195a9712d79 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Tue, 14 Jul 2026 18:02:37 +0300 Subject: [PATCH] refactor(ImageLightbox): pin close button via a fixed wrapper --- src/shared/ui/ImageLightbox/ui/ImageLightbox.test.tsx | 4 ++-- src/shared/ui/ImageLightbox/ui/ImageLightbox.tsx | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/shared/ui/ImageLightbox/ui/ImageLightbox.test.tsx b/src/shared/ui/ImageLightbox/ui/ImageLightbox.test.tsx index 2bf7a99..75de5b0 100644 --- a/src/shared/ui/ImageLightbox/ui/ImageLightbox.test.tsx +++ b/src/shared/ui/ImageLightbox/ui/ImageLightbox.test.tsx @@ -81,10 +81,10 @@ describe('ImageLightbox', () => { expect(document.body.style.overflow).toBe(''); }); - it('close button is positioned fixed', () => { + it('close button is pinned via a fixed wrapper', () => { render(); const closeBtn = screen.getByRole('button', { name: /close/i, hidden: true }); - expect(closeBtn).toHaveClass('fixed'); + expect(closeBtn.parentElement).toHaveClass('fixed'); }); }); }); diff --git a/src/shared/ui/ImageLightbox/ui/ImageLightbox.tsx b/src/shared/ui/ImageLightbox/ui/ImageLightbox.tsx index 02d9a38..aaff66e 100644 --- a/src/shared/ui/ImageLightbox/ui/ImageLightbox.tsx +++ b/src/shared/ui/ImageLightbox/ui/ImageLightbox.tsx @@ -188,9 +188,11 @@ export function ImageLightbox({ className="lightbox-image block w-auto h-auto" /> - +
+ +
);