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(frontend): keep the reader banner visible while scrolling (#10390)

Kiran Gadhavec86eff21deed
diff --git a/frontend/src/components/editor/__tests__/viewer-banner.test.tsx b/frontend/src/components/editor/__tests__/viewer-banner.test.tsx
index 23f0839b43..5aaa6d976d 100644
--- a/frontend/src/components/editor/__tests__/viewer-banner.test.tsx
+++ b/frontend/src/components/editor/__tests__/viewer-banner.test.tsx
@@ -54,6 +54,20 @@ describe("ViewerBanner", () => {
expect(container).toBeEmptyDOMElement();
});
+ it("pins the banner without reserving layout space", () => {
+ const store = createStore();
+ store.set(kioskModeAtom, true);
+ render(
+ <Provider store={store}>
+ <TooltipProvider>
+ <ViewerBanner />
+ </TooltipProvider>
+ </Provider>,
+ );
+ const wrapper = screen.getByTestId("takeover-button").closest("div.sticky");
+ expect(wrapper).toHaveClass("sticky", "top-2", "h-0");
+ });
+
it("renders nothing in present mode", () => {
const store = createStore();
store.set(kioskModeAtom, true);
diff --git a/frontend/src/components/editor/viewer-banner.tsx b/frontend/src/components/editor/viewer-banner.tsx
index 2e53956b93..87835b2d91 100644
--- a/frontend/src/components/editor/viewer-banner.tsx
+++ b/frontend/src/components/editor/viewer-banner.tsx
@@ -51,8 +51,11 @@ export const ViewerBanner = () => {
}
};
+ // A zero-height sticky row pins the banner to the top-left of the notebook
+ // scroll area, so it stays visible while scrolling without reserving space in
+ // the flow.
return (
- <div className="absolute top-2 left-2 z-50 w-fit print:hidden">
+ <div className="sticky top-2 left-2 z-50 h-0 ml-2 w-fit print:hidden">
<Banner
kind="info"
className="flex items-center gap-2 rounded px-2 py-1 text-xs shadow-sm"
diff --git a/frontend/src/core/edit-app.tsx b/frontend/src/core/edit-app.tsx
index fab57aca47..ee06beb066 100644
--- a/frontend/src/core/edit-app.tsx
+++ b/frontend/src/core/edit-app.tsx
@@ -164,6 +164,7 @@ export const EditApp: React.FC<AppProps> = ({
width={appConfig.width}
onReconnect={reconnect}
>
+ <ViewerBanner />
<AppHeader
connection={connection}
className={cn(
@@ -179,8 +180,6 @@ export const EditApp: React.FC<AppProps> = ({
)}
</AppHeader>
- <ViewerBanner />
-
{/* Don't render until we have a single cell. NotStartedConnectionAlert
still covers the "no remote runtime started" prompt. */}
<ProgressiveBoundary