fix: trigger onClickOutside when click escape for closing the model a… (#12461)
Description: Resolved a bug where pressing the Escape key did not clear the filter chips when no filter value was present. Added a call to onClickOutside inside the useScopedHotkeys hook to ensure filter chips are removed when Escape is pressed and the dropdown is open but empty. https://github.com/user-attachments/assets/42ed35b0-f5a8-4d26-8407-fdd5e2cc4a42 fix #12319
This commit is contained in:
@ -30,7 +30,7 @@ export const EditableFilterDropdownButton = ({
|
|||||||
removeRecordFilter({ recordFilterId: recordFilter.id });
|
removeRecordFilter({ recordFilterId: recordFilter.id });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDropdownClickOutside = useCallback(() => {
|
const onFilterDropdownClose = useCallback(() => {
|
||||||
const recordFilterIsEmpty = isRecordFilterConsideredEmpty(recordFilter);
|
const recordFilterIsEmpty = isRecordFilterConsideredEmpty(recordFilter);
|
||||||
|
|
||||||
if (recordFilterIsEmpty) {
|
if (recordFilterIsEmpty) {
|
||||||
@ -62,7 +62,7 @@ export const EditableFilterDropdownButton = ({
|
|||||||
dropdownHotkeyScope={hotkeyScope}
|
dropdownHotkeyScope={hotkeyScope}
|
||||||
dropdownOffset={{ y: 8, x: 0 }}
|
dropdownOffset={{ y: 8, x: 0 }}
|
||||||
dropdownPlacement="bottom-start"
|
dropdownPlacement="bottom-start"
|
||||||
onClickOutside={handleDropdownClickOutside}
|
onClose={onFilterDropdownClose}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user