Skip to content

Improve running cell UX and auto-scroll streaming output#8893

Open
axsseldz wants to merge 1 commit intomarimo-team:mainfrom
axsseldz:feat/active-cell-ux
Open

Improve running cell UX and auto-scroll streaming output#8893
axsseldz wants to merge 1 commit intomarimo-team:mainfrom
axsseldz:feat/active-cell-ux

Conversation

@axsseldz
Copy link
Copy Markdown
Contributor

@axsseldz axsseldz commented Mar 27, 2026

📝 Summary

Improve UX for running cells by making the active cell easier to identify and automatically following streaming output.

🔍 Changes

  • use a more native marimo accent color for the running cell highlight
  • improve visibility of the running state with a clearer Running status pill
  • auto-scroll output to show the latest content while a cell is running
  • pause auto-scroll when the user scrolls up, and resume when they return to the bottom

Before

  • running cells were difficult to distinguish from idle cells
  • users had to rely on a small timer to detect activity
  • streaming output did not automatically follow new lines
before

After

  • running cells are easier to identify at a glance
  • running state feels more consistent with marimo UI
  • output automatically follows new content during execution
  • users can scroll up without losing control of the view
after

💬 Discussion

This PR is meant as a lightweight UX proposal to explore how running cells could be more clearly communicated without introducing major visual changes. The intention is to start a conversation and gather feedback on whether this direction feels natural within marimo’s design.

Open to suggestions on:

  • how strong or subtle the running indicator should be
  • whether the auto-scroll behavior feels intuitive
  • alternative ideas that could better communicate active execution

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Tests have been added for the changes made.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Pull request title is a good summary of the changes - it will be used in the release notes.

@mscolnick @nojaf

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Mar 27, 2026 8:03am

Request Review

@axsseldz axsseldz force-pushed the feat/active-cell-ux branch from 62b6186 to 1251863 Compare March 27, 2026 08:02
@axsseldz axsseldz marked this pull request as ready for review March 27, 2026 08:21
Copilot AI review requested due to automatic review settings March 27, 2026 08:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the notebook editing experience by making running cells more visually identifiable and by automatically keeping streaming console output scrolled to the latest content during execution.

Changes:

  • Add a running-state visual treatment for cells and a clearer “Running” status pill.
  • Add auto-follow behavior for streaming console output while a cell is running (with user scroll override).
  • Update/extend frontend tests and snapshots; minor cleanup in a Plotly example.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
frontend/src/css/app/Cell.css Adds running-cell highlight styles/animation.
frontend/src/components/editor/cell/cell-status.css Styles the running “pill” + pulse indicator.
frontend/src/components/editor/cell/CellStatus.tsx Adds “Running” label next to the timer.
frontend/src/components/editor/notebook-cell.tsx Applies running class to cells and passes running into ConsoleOutput.
frontend/src/components/editor/output/console/ConsoleOutput.tsx Implements conditional auto-scroll-follow for streaming output while running.
frontend/src/components/editor/output/console/tests/ConsoleOutput.test.tsx Adds tests around the new auto-scroll behavior.
frontend/src/components/editor/renderers/vertical-layout/vertical-layout.tsx Passes the new running prop (currently hard-coded false).
frontend/src/components/scratchpad/scratchpad.tsx Passes running state into ConsoleOutput for scratchpad.
frontend/src/tests/snapshots/CellStatus.test.tsx.snap Updates snapshot for the new running label.
examples/third_party/plotly/histogram.py Removes a stray line artifact.

Comment on lines +169 to +177
const appendedOutput =
consoleOutputs.length > prevRenderedOutputCountRef.current;
prevRenderedOutputCountRef.current = consoleOutputs.length;

if (!running || !appendedOutput || !shouldFollowOutputRef.current) {
return;
}

el.scrollTop = el.scrollHeight - el.clientHeight;
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-scroll only triggers when consoleOutputs.length increases. Because collapseConsoleOutputs can merge streaming updates into an existing message (length stays the same while data grows/changes, e.g. carriage-return progress updates), the console may stop following output even though new content is rendered. Consider tracking a more reliable “new content rendered” signal (e.g., last output reference/timestamp or combined text length) instead of only the array length.

Copilot uses AI. Check for mistakes.
<ConsoleOutput
consoleOutputs={consoleOutputs}
stale={outputStale}
running={false}
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VerticalCell already has access to status, but ConsoleOutput is hard-coded with running={false}. This disables the new follow-streaming-output behavior in vertical layout even when a cell is actually running. Pass running={status === "running"} (or equivalent) so behavior is consistent across renderers.

Suggested change
running={false}
running={status === "running"}

Copilot uses AI. Check for mistakes.
Comment on lines +333 to +357
it("follows newly appended output while running when already at the bottom", () => {
const { rerender } = renderWithProvider(
<ConsoleOutput
{...defaultProps}
consoleOutputs={[createOutput("line 1")]}
/>,
);

const consoleArea = screen.getByTestId("console-output-area");
setScrollMetrics(consoleArea, {
clientHeight: 100,
scrollHeight: 300,
scrollTop: 200,
});

rerender(
<TooltipProvider>
<ConsoleOutput
{...defaultProps}
consoleOutputs={[createOutput("line 1"), createOutput("line 2")]}
/>
</TooltipProvider>,
);

expect(consoleArea.scrollTop).toBe(200);
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “follows newly appended output” test doesn't currently validate that scrolling happens: scrollHeight/clientHeight are kept constant across the rerender, so scrollTop would remain 200 even if the auto-scroll effect never ran. To make this test meaningful, simulate the content growth by increasing scrollHeight before rerender and assert that scrollTop updates to the new bottom offset.

Copilot uses AI. Check for mistakes.
@mscolnick
Copy link
Copy Markdown
Contributor

thanks for sharing this design. i quite like the idea of a stronger indicator. if its ok with you, ill see if we can bring a designer in to iterate on the exact design for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants