Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

add default focus for cell-links (#8372)

Shahmir Varqhaadbb3ae71d30
diff --git a/frontend/src/components/editor/links/cell-link.tsx b/frontend/src/components/editor/links/cell-link.tsx
index 43e4cb11cd..e6c1c48d69 100644
--- a/frontend/src/components/editor/links/cell-link.tsx
+++ b/frontend/src/components/editor/links/cell-link.tsx
@@ -97,6 +97,7 @@ export function scrollAndHighlightCell(
): boolean {
const cellHtmlId = HTMLCellId.create(cellId);
const cell: HTMLElement | null = document.getElementById(cellHtmlId);
+ const isCellErrored = cell?.classList.contains("has-error");
if (cell === null) {
Logger.error(`Cell ${cellHtmlId} not found on page.`);
@@ -106,13 +107,13 @@ export function scrollAndHighlightCell(
cell.scrollIntoView({ behavior: "smooth", block: "center" });
}
- if (variant === "destructive") {
+ if (variant === "destructive" || (isCellErrored && variant === undefined)) {
cell.classList.add("error-outline");
setTimeout(() => {
cell.classList.remove("error-outline");
}, 2000);
}
- if (variant === "focus") {
+ if (variant === "focus" || (!isCellErrored && variant === undefined)) {
cell.classList.add("focus-outline");
setTimeout(() => {
cell.classList.remove("focus-outline");