feat(SW-337): logic for accesible dialog title text for lightbox

This commit is contained in:
Chuma McPhoy
2024-09-09 15:03:37 +02:00
parent 852e817ab7
commit d92308b99d
12 changed files with 32 additions and 11 deletions

View File

@@ -16,6 +16,7 @@ import type { GalleryProps } from "@/types/components/lightbox/lightbox"
export default function Gallery({
images,
dialogTitle,
onClose,
onSelectImage,
onImageClick,
@@ -58,7 +59,7 @@ export default function Gallery({
<div className={styles.desktopGallery}>
<VisuallyHidden asChild>
<DialogTitle asChild>
<VisuallyHidden>Image Gallery</VisuallyHidden>
<VisuallyHidden>{dialogTitle}</VisuallyHidden>
</DialogTitle>
</VisuallyHidden>
<div className={styles.galleryHeader}>

View File

@@ -10,7 +10,11 @@ import styles from "./Lightbox.module.css"
import type { LightboxProps } from "@/types/components/lightbox/lightbox"
export default function Lightbox({ images, children }: LightboxProps) {
export default function Lightbox({
images,
children,
dialogTitle,
}: LightboxProps) {
const [isOpen, setIsOpen] = useState(false)
const [selectedImageIndex, setSelectedImageIndex] = useState(0)
const [isFullView, setIsFullView] = useState(false)
@@ -93,6 +97,7 @@ export default function Lightbox({ images, children }: LightboxProps) {
) : (
<Gallery
images={images}
dialogTitle={dialogTitle}
onClose={() => setIsOpen(false)}
onSelectImage={(image) => {
setSelectedImageIndex(