Repository navigation
perf: mount the cell delete button on hover or focus - #12247
Merged
Merged
Conversation
Contributor
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
Coverage Report for ./frontend
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The tests hide an invalid connection-state fixture behind a cast, and the pointer hook bypasses the required shared-subscription helper.
2 open issues
What changed in this PR
Reduces idle DOM overhead in marimo notebooks by mounting cell delete buttons only when needed, while preserving touch access and improving keyboard interaction.
Changes:
- Mount delete controls on hover or cell focus, using a shared pointer-capability listener.
- Preserve focused-button visibility and native Enter/Space activation.
- Add tests for mounting, pointer changes, deletion guards, and keyboard events.
| File | Description |
|---|---|
| frontend/src/hooks/useFinePointer.ts | Tracks pointer capabilities through a shared listener. |
| frontend/src/css/common.css | Keeps delete controls visible during non-editor focus. |
| frontend/src/components/editor/notebook-cell.tsx | Integrates conditional delete controls into editable and setup cells. |
| frontend/src/components/editor/cell/DeleteButton.tsx | Preserves focus styling and keyboard activation. |
| frontend/src/components/editor/cell/CellDeleteShoulder.tsx | Gates button mounting by hover, focus, and pointer capabilities. |
| frontend/src/components/editor/cell/__tests__/CellDeleteShoulder.test.tsx | Tests mounting behavior and delete-button interactions. |
Review effort: Balanced
mscolnick
previously approved these changes
Dec 2, 2026
Fine-pointer devices mount the button only while the cell is hovered or holds focus. Touch devices keep it mounted. A focused button stays visible and activates with Enter or Space.
Focus on an output control no longer shows the button. The pointer hook uses the shared subscription helper.
kirangadhave
force-pushed
the
kg/lazy-cell-delete
branch
from
December 3, 2026 01:07
85f0ca0 to
4d8fd20
Compare
mscolnick
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

📝 Summary
Each editable cell mounted a Delete button that CSS hid until hover. A 500-cell notebook carried 500 idle buttons and 3,500 elements for them. This change covers the Delete task in MO-8795.
Mount the Delete button only while the cell is hovered or holds focus on fine-pointer devices. Touch devices keep the button mounted, and the gate follows pointer capability changes through one shared media query listener. The shoulder wrapper always renders, so layout and the hit area do not change. The
canDelete, code-visibility, running, queued and connection guards are unchanged, and so are delete and undo.A focused Delete button now stays visible, shows its focus ring, and activates with Enter or Space. Before, the button lost focus when the pointer was outside the cell, and an unmodified Enter reached cell navigation. Focus on any other element in the cell does not show the button.
Evidence
Production builds in headless Chromium, 500 Python cells, no outputs. Median of 7 runs per build in alternating order.
src/components/editor. The frontend type check, changed-file lint, and formatting checks passed.Part of MO-8795
📋 Pre-Review Checklist
✅ Merge Checklist