Skip to content
Snippets Groups Projects
Unverified Commit 1e380553 authored by Matiss Janis Aboltins's avatar Matiss Janis Aboltins Committed by GitHub
Browse files

:bug: (popover) fix date popover closing when editing a filter (#3009)

parent 0ee91268
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,8 @@ import { Value } from '../rules/Value';
import { FilterEditor } from './FiltersMenu';
import { subfieldFromFilter } from './subfieldFromFilter';
let isDatepickerClick = false;
type FilterExpressionProps = {
field: string | undefined;
customName: string | undefined;
......@@ -100,6 +102,21 @@ export function FilterExpression({
placement="bottom start"
isOpen={editing}
onOpenChange={() => setEditing(false)}
shouldCloseOnInteractOutside={element => {
// Datepicker selections for some reason register 2x clicks
// We want to keep the popover open after selecting a date.
// So we ignore the "close" event on selection + the subsequent event.
if (element instanceof HTMLElement && element.dataset.pikaYear) {
isDatepickerClick = true;
return false;
}
if (isDatepickerClick) {
isDatepickerClick = false;
return false;
}
return true;
}}
style={{ width: 275, padding: 15, color: theme.menuItemText }}
data-testid="filters-menu-tooltip"
>
......
---
category: Bugfix
authors: [MatissJanis]
---
Fix datepicker closing when trying to edit a date filter
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment