Skip to content

Draw no block handle beside the empty line under the last block - #969

Merged
lavaman131 merged 1 commit into
mainfrom
last-block-hover
Nov 20, 2026
Merged

lavaman131 merged 1 commit into
mainfrom
last-block-hover

Conversation

@lavaman131

Copy link
Copy Markdown
Collaborator

Why

Pointing just below a document's last block showed the block handle (⋮⋮) beside nothing, as though a thin block were there.

The editor keeps an empty paragraph under the last block so the caret has somewhere to go:

  • MDXEditor appends one whenever the document ends with a decorator: a decision or question card, a research card or a divider.
  • When a decided card gives its place to its prose, the card collapses to no height, so that empty line sits right under the prose.

The handle's pointer tracking (BlockHandlePlugin in packages/editor/src/widgets/block-handle.tsx) counted that line as a block. Any pointer in a band about one line tall below the last block brought up the handle.

What

The tracker now passes over an empty paragraph at the document's own level when no block with something on it follows. Nothing else changes:

  • The paragraph stays. A click below the last block still puts the caret there, and the editor still keeps a line after a final card.
  • Once something is written on that line, it is a block with its handle.
  • An empty line between two blocks keeps its handle.
  • A blank document's only body line, which carries the writing prompt, keeps its handle.
  • Mod+/, blocks selected as blocks, and the touch handle are unchanged.

Before and after

Each case was checked in Chromium. A pixel diff of the document pane compared the pointer resting over Chat with the pointer at every 3px from the last block's bottom to 61px below it.

Document ends with Before After
A decided decision (card collapsed under its prose) Handle beside the empty line 12 to 37px below the prose Nothing changes on screen
An open decision Handle beside the empty line under the card Nothing changes on screen
A deck of three decisions Handle beside the empty line under the deck Nothing changes on screen
A research card Handle beside the empty line under the card Nothing changes on screen
A paragraph and a line left empty by Enter Handle beside the empty line Nothing changes on screen
A divider Handle beside the empty line under the rule Nothing changes on screen
Control: an empty line between two paragraphs Handle Handle, unchanged

Tests

e2e/block-handle-controls.e2e.ts gains two tests: one with an open decision last, and one with a decided decision's prose last. In each, the pointer first rests on the last block, where the handle shows. It then moves to points 6px apart from just below that block to past the end of the empty line. At every point the handle must be gone. A click on the line and some typing then writes a paragraph after the questionnaire in the saved MDX, and that paragraph has its handle.

Both tests failed before the fix for the reason above: the handle was still shown 20px below the open decision and 14px below the decided decision's prose.

Verification on 409993b:

  • bun run fix: no changes. bun run ci and bun run types pass.
  • bun test packages/editor passes: 1005 tests.
  • In Chromium, with my own PostgreSQL and E2E_PORT_BASE under flock:
    • block-handle-controls, block-selection, notion-blocks, inline-decision-deck, decision-marker, focus, columns and callout: 77 passed with 4 workers.
    • 4 deck-motion and focus tests timed out under load. focus.e2e.ts and inline-decision-deck.e2e.ts passed in full when rerun with 1 worker (24 passed).

The editor keeps an empty paragraph under the document's last block for the
caret: MDXEditor appends one whenever the document ends with a card or a
divider, and a decided card that gives its place to its prose leaves that line
right under the prose. The handle's pointer tracking counted it as a block, so
pointing just below the last block drew the handle beside a blank band about a
line tall, as though a thin block were there.

The handle now passes over an empty paragraph of the document's own when no
block with something on it follows. The paragraph stays, so a click below the
last block still puts the caret there and what is written there has its handle;
an empty line between two blocks keeps its handle too. A browser test points a
few pixels at a time below an open decision and below a decided decision's
prose, then writes on the line.

Co-authored-by: Alex Lavaee <lavaman131@github.com>
@lavaman131
lavaman131 merged commit 73d6370 into main Nov 20, 2026
25 checks passed
@lavaman131
lavaman131 deleted the last-block-hover branch November 20, 2026 21:42
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.

1 participant