🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(web): prevent DataTable onRowClick when clicking interactive elements (#12881)
marliessophie9e59c2c2a7f8
diff --git a/web/src/components/table/data-table.tsx b/web/src/components/table/data-table.tsxindex 20c644ded6..53cc4b25ca 100644--- a/web/src/components/table/data-table.tsx+++ b/web/src/components/table/data-table.tsx@@ -113,6 +113,15 @@ function isValidCssVariableName({return regex.test(name);}+const INTERACTIVE_ROW_CLICK_SELECTOR =+ "a, button, input, select, textarea, summary, [role='button'], [role='link']";++export const shouldIgnoreRowClickTarget = (target: EventTarget | null) => {+ if (!(target instanceof Element)) return false;++ return Boolean(target.closest(INTERACTIVE_ROW_CLICK_SELECTOR));+};+// These are the important styles to make sticky column pinning work!const getCommonPinningStyles = <TData,>(column: Column<TData>,@@ -511,9 +520,13 @@ function TableRowComponent<TData>({return (<TableRowdata-row-index={row.index}- onClick={(e) => onRowClick?.(row.original, e)}+ onClick={(e) => {+ if (shouldIgnoreRowClickTarget(e.target)) return;+ onRowClick?.(row.original, e);+ }}onKeyDown={(e) => {if (e.key === "Enter") {+ if (shouldIgnoreRowClickTarget(e.target)) return;onRowClick?.(row.original);}}}