Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowed the record selector modal to remain open on double-clicking the selected FK cell #4043

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading