Skip to content

Commit

Permalink
Merge pull request #6645 from qburst/master
Browse files Browse the repository at this point in the history
fix: #6644, Galleria: Galleria image in fullscreen mode not closing on escape button click
  • Loading branch information
nitrogenous committed May 24, 2024
2 parents aad5f28 + 7c6ea86 commit 3f0d1a6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/lib/galleria/Galleria.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import PrimeReact, { PrimeReactContext, localeOption } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { CSSTransition } from '../csstransition/CSSTransition';
import { useInterval, useMergeProps, useUnmountEffect } from '../hooks/Hooks';
import { useInterval, useMergeProps, useUnmountEffect, ESC_KEY_HANDLING_PRIORITIES, useGlobalOnEscapeKey } from '../hooks/Hooks';
import { TimesIcon } from '../icons/times';
import { Portal } from '../portal/Portal';
import { Ripple } from '../ripple/Ripple';
Expand Down Expand Up @@ -40,6 +40,14 @@ export const Galleria = React.memo(

useHandleStyle(GalleriaBase.css.styles, isUnstyled, { name: 'galleria' });

useGlobalOnEscapeKey({
callback: () => {
hide();
},
when: props.closeOnEscape && props.fullScreen,
priority: [ESC_KEY_HANDLING_PRIORITIES.IMAGE, 0]
});

useInterval(
() => {
onActiveItemChange({ index: props.circular && props.value.length - 1 === activeItemIndex ? 0 : activeItemIndex + 1 });
Expand Down

0 comments on commit 3f0d1a6

Please sign in to comment.