Skip to content

Delete backward when the current line range is empty - #6203

Merged
dylans merged 1 commit into
mainfrom
delete-line-start
Oct 10, 2026
Merged

dylans merged 1 commit into
mainfrom
delete-line-start

Conversation

@dylans

@dylans dylans commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Deleting backward by line did nothing when the computed line range was collapsed. Delegate that case to character deletion so empty paragraphs and block starts merge with preceding content.

Fixes #4263

Case Before After
deleteSoftLineBackward at an empty or non-empty block start No-op Merges into the preceding block, caret at the join
Empty list item No-op Merges into the previous item, retaining the list
Empty block after a void No-op Removes the empty block, retains and selects the void
Current line has text before the caret Deletes that text Unchanged
Document start, table cell boundaries Preserved Preserved

The tests dispatch deleteSoftLineBackward directly, avoiding platform-specific keyboard mappings. Both block-start regressions fail on main 8f59fd3 in Chromium, Firefox and WebKit. WebKit's physical Cmd+Backspace normally sends deleteHardLineBackward and does not use this changed path.

Validation: 48 focused checks passed (eight scenarios, three desktop browsers, twice); 16 synthetic-mobile checks skipped. Includes lists, tables, a preceding void, and a soft-wrapped line. check.sh passed on Node 24.21.0: 1,468 Mocha / 141 Jest tests, build, TypeScript, ESLint and Prettier. Playwright TypeScript and formatting pass, including the added wrapped-line test.

Android uses the same deleteBackward path, but a physical soft-keyboard check remains pending. A slate-dom patch changeset is included. Forward deletion and block-unit deletion are unchanged.

Full browser suite: 284 passed / 25 skipped / 3 failures. The Chromium Markdown list failure reproduces on main (2 of 12 repeated Markdown tests failed). Mobile mentions suggestions and paste-code setup also failed once; both pass twice on the fix and four times on main. Those two intermittent failures were not reproduced on main. Their existing setup uses DOM selectText plus plain Backspace; it does not intentionally exercise line deletion. The paste failure left the initial two code elements present. The new 24 desktop checks all pass in the full run. This is not an entirely green browser run. The markdown-shortcuts failure is a test-timing flake (a click processed after the keys that follow it), fixed separately in #6205.

@changeset-bot

changeset-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 31f6310

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
slate-dom Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dylans
dylans merged commit e78057b into main Oct 10, 2026
16 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 10, 2026
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.

Mod + Delete regression from 0.61 to 0.62: Not deleting empty nodes

1 participant