Skip to content

Commit

Permalink
Merge pull request #4043 from TalhaZaheer1/fix-double_click
Browse files Browse the repository at this point in the history
Allowed the record selector modal to remain open on double-clicking the selected FK cell
  • Loading branch information
seancolsen authored Dec 4, 2024
2 parents 18fe2f3 + f5289c6 commit 3b769bf
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { onMount } from 'svelte';
import { _ } from 'svelte-i18n';
import { RichText } from '@mathesar/components/rich-text';
Expand All @@ -24,6 +25,7 @@
export let windowPositionerElement: HTMLElement;
let contentHeight = 0;
let controllerCanCancel = false;
$: nestedController = new RecordSelectorController({
nestingLevel: controller.nestingLevel + 1,
Expand Down Expand Up @@ -67,6 +69,14 @@
return false; // Parent element not found in the hierarchy
}
// Prevents the RecordSelector Modal from closing for 300ms
// after mounting to preserve double click behaviour
onMount(() => {
setTimeout(() => {
controllerCanCancel = true;
}, 300);
});
function onWindowClick(event: MouseEvent) {
if ($nestedSelectorIsOpen) return;
Expand All @@ -77,7 +87,7 @@
currentWindow,
);
if (!isElementInside) controller.cancel();
if (!isElementInside && controllerCanCancel) controller.cancel();
}
</script>

Expand Down

0 comments on commit 3b769bf

Please sign in to comment.