#2472·milkdown

[Bug]: Clicking the + block-edit button inside a list item opens the slash menu and immediately closes it (~20ms later), so nothing can be selected.

Author: AkshaychdevCreated Sep 8, 2026Updated Sep 8, 2026
Labelsbug

Initial checklist

Affected packages and versions

in @milkdown/crepe (v7.21.3)

Link to runnable example

No response

Steps to reproduce

Steps to reproduce:

  1. Create a default Crepe editor with default features (no custom config needed):
typescript
import { Crepe } from '@milkdown/crepe'
import '@milkdown/crepe/theme/common/style.css'
import '@milkdown/crepe/theme/frame.css'

const crepe = new Crepe({
  root: document.querySelector('#app'),
  defaultValue: '- Main\n',
})
crepe.create()
  1. Place the cursor at the end of the list item text (Main).
  2. Hover the line to reveal the + (block-edit handle) button on the left, and click it.
  3. Observe: the slash/block menu flashes open for an instant, then closes immediately (roughly a 20ms window), so no menu item can be clicked or selected.
  4. For comparison, do the same on a plain paragraph (not inside a list item) — the menu opens and stays open normally.

Root cause (from tracing the source):

  • packages/crepe/src/feature/block-edit/handle/index.ts onAdd() inserts a new paragraph and calls menuAPI.show(pos), opening the menu.
  • That transaction also triggers packages/crepe/src/feature/block-edit/menu/index.ts's debounced (debounce: 20) shouldShow recheck via the SlashProvider's onUpdate.
  • shouldShow calls isInList(selection) (utils/checker.ts), which returns true whenever the selection's grandparent node is list_item - which is exactly the state left behind by the + button's own insert when clicked inside a list item. shouldShow returns false, hiding the menu it just opened.
  • isInList appears intended to suppress the typed / trigger while composing list text, but it also incorrectly fires against the button's own programmatic menuAPI.show() call.

Expected behavior

Clicking + inside a list item opens the block menu and keeps it open until the user picks an item or dismisses it, same as for a paragraph.

Actual behavior

The menu closes itself almost immediately after opening, making it impossible to use + inside list items.

Runtime

Chrome

OS

Linux

Build and bundle tools

Vite