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.

fix: outline with headers that start with a number (#283)

Myles Scolnickca6d553f03f7
diff --git a/frontend/src/editor/chrome/panels/outline-panel.tsx b/frontend/src/editor/chrome/panels/outline-panel.tsx
index a0a2477bbc..1ca576faba 100644
--- a/frontend/src/editor/chrome/panels/outline-panel.tsx
+++ b/frontend/src/editor/chrome/panels/outline-panel.tsx
@@ -21,7 +21,8 @@ export const OutlinePanel: React.FC = () => {
const handleGoToItem = (id: string, index: number) => {
// Selectors may be duplicated, so we need to use querySelectorAll
- const elems = document.querySelectorAll(`#${id}`);
+ // IDs that start with a number are invalid, so we need to escape them
+ const elems = document.querySelectorAll(`[id="${CSS.escape(id)}"]`);
const el = elems[index];
if (el) {
el.scrollIntoView({ behavior: "smooth", block: "start" });