Merged in feat/SW-2800-lightbox-history-state (pull request #2147)

feat(SW-2800): closing image gallery and lightbox on using browser navigation

* feat(SW-2800): closing image gallery and lightbox on using browser navigation


Approved-by: Linus Flood
This commit is contained in:
Erik Tiekstra
2025-05-19 13:58:20 +00:00
committed by Linus Flood
parent 93a155f1e4
commit 41e09f082a
4 changed files with 26 additions and 12 deletions

View File

@@ -24,7 +24,7 @@ function ImageGallery({
hideLabel,
}: ImageGalleryProps) {
const intl = useIntl()
const [lightboxIsOpen, setLightboxIsOpen] = useState(false)
const [isOpen, setIsOpen] = useState(false)
const [imageError, setImageError] = useState(false)
const imageProps = fill ? { fill, sizes } : { height, width: height * 1.5 }
@@ -52,7 +52,7 @@ function ImageGallery({
</Typography>
<Button
className={styles.triggerArea}
onPress={() => setLightboxIsOpen(true)}
onPress={() => setIsOpen(true)}
aria-label={intl.formatMessage({
defaultMessage: "Open image gallery",
})}
@@ -61,8 +61,8 @@ function ImageGallery({
<Lightbox
images={images}
dialogTitle={title}
isOpen={lightboxIsOpen}
onClose={() => setLightboxIsOpen(false)}
isOpen={isOpen}
onClose={() => setIsOpen(false)}
hideLabel={hideLabel}
/>
</>