Skip to content

Commit

Permalink
fix: primefaces#6693, colorpicker: Color picker popup not closing on …
Browse files Browse the repository at this point in the history
…escape button click in some specific scenarios
  • Loading branch information
ANTONA09 committed May 28, 2024
1 parent 063c100 commit f0eded4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components/lib/colorpicker/ColorPicker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import PrimeReact, { PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { useEventListener, useMergeProps, useMountEffect, useOverlayListener, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { useEventListener, useMergeProps, useMountEffect, useOverlayListener, useUnmountEffect, useUpdateEffect, useGlobalOnEscapeKey, ESC_KEY_HANDLING_PRIORITIES, useDisplayOrder } from '../hooks/Hooks';
import { OverlayService } from '../overlayservice/OverlayService';
import { Tooltip } from '../tooltip/Tooltip';
import { DomHandler, ObjectUtils, ZIndexUtils, classNames } from '../utils/Utils';
Expand All @@ -20,8 +20,17 @@ export const ColorPicker = React.memo(
overlayVisible: overlayVisibleState
}
});
const isCloseOnEscape = overlayVisibleState && props.closeOnEscape;
const overlayDisplayOrder = useDisplayOrder('overlay-panel', isCloseOnEscape);

useHandleStyle(ColorPickerBase.css.styles, isUnstyled, { name: 'colorpicker' });
useGlobalOnEscapeKey({
callback: () => {
hide();
},
when: overlayVisibleState && overlayDisplayOrder,
priority: [ESC_KEY_HANDLING_PRIORITIES.OVERLAY_PANEL, overlayDisplayOrder]
});
const elementRef = React.useRef(null);
const overlayRef = React.useRef(null);
const inputRef = React.useRef(props.inputRef);
Expand Down

0 comments on commit f0eded4

Please sign in to comment.