From 17ac660804c67d279a7f214704b98271debdc803 Mon Sep 17 00:00:00 2001 From: Vishal Joshi Date: Tue, 17 Dec 2024 22:31:17 +0530 Subject: [PATCH 1/3] Added allow users to hover over record-level error messages --- .../src/systems/table-view/row/CellErrors.svelte | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mathesar_ui/src/systems/table-view/row/CellErrors.svelte b/mathesar_ui/src/systems/table-view/row/CellErrors.svelte index 87cb62e581..4bf883d1fb 100644 --- a/mathesar_ui/src/systems/table-view/row/CellErrors.svelte +++ b/mathesar_ui/src/systems/table-view/row/CellErrors.svelte @@ -9,11 +9,17 @@ let errorIndicatorElement: SVGSVGElement | undefined; let cellElementIsHovered = false; + let hideTimeout: number; + function setHover() { + clearTimeout(hideTimeout); cellElementIsHovered = true; } + function unsetHover() { - cellElementIsHovered = false; + hideTimeout = setTimeout(() => { + cellElementIsHovered = false; + }, 1); } onMount(() => { const cell = errorIndicatorElement?.parentElement; @@ -47,6 +53,8 @@ reference: cellElement, options: { placement: 'top-start' }, }} + on:mouseenter={() => setHover()} + on:mouseleave={() => unsetHover()} > {errors.join(' ')} From 38fec6e082928e88fd69493f8f0dc5e426b1f816 Mon Sep 17 00:00:00 2001 From: Sean Colsen Date: Wed, 18 Dec 2024 09:34:38 -0500 Subject: [PATCH 2/3] Qualify setTimeout within window --- mathesar_ui/src/systems/table-view/row/CellErrors.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mathesar_ui/src/systems/table-view/row/CellErrors.svelte b/mathesar_ui/src/systems/table-view/row/CellErrors.svelte index 4bf883d1fb..7b932d3290 100644 --- a/mathesar_ui/src/systems/table-view/row/CellErrors.svelte +++ b/mathesar_ui/src/systems/table-view/row/CellErrors.svelte @@ -12,12 +12,12 @@ let hideTimeout: number; function setHover() { - clearTimeout(hideTimeout); + window.clearTimeout(hideTimeout); cellElementIsHovered = true; } function unsetHover() { - hideTimeout = setTimeout(() => { + hideTimeout = window.setTimeout(() => { cellElementIsHovered = false; }, 1); } From 52d597e7f79ca314de150d2965ab31df3501e57b Mon Sep 17 00:00:00 2001 From: Sean Colsen Date: Wed, 18 Dec 2024 09:35:21 -0500 Subject: [PATCH 3/3] Improve variable naming --- mathesar_ui/src/systems/table-view/row/CellErrors.svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mathesar_ui/src/systems/table-view/row/CellErrors.svelte b/mathesar_ui/src/systems/table-view/row/CellErrors.svelte index 7b932d3290..5a793ea7d5 100644 --- a/mathesar_ui/src/systems/table-view/row/CellErrors.svelte +++ b/mathesar_ui/src/systems/table-view/row/CellErrors.svelte @@ -8,16 +8,15 @@ let errorIndicatorElement: SVGSVGElement | undefined; let cellElementIsHovered = false; - - let hideTimeout: number; + let hiderTimeoutId: number; function setHover() { - window.clearTimeout(hideTimeout); + window.clearTimeout(hiderTimeoutId); cellElementIsHovered = true; } function unsetHover() { - hideTimeout = window.setTimeout(() => { + hiderTimeoutId = window.setTimeout(() => { cellElementIsHovered = false; }, 1); }