Skip to content

fix(editor): fire correct behavior events for Android diff-path deletions#2268

Closed
christianhg wants to merge 1 commit intomainfrom
fix/android-delete-backward
Closed

fix(editor): fire correct behavior events for Android diff-path deletions#2268
christianhg wants to merge 1 commit intomainfrom
fix/android-delete-backward

Conversation

@christianhg
Copy link
Copy Markdown
Member

@christianhg christianhg commented Feb 28, 2026

Fix: Fire correct behavior events for Android deletions

Problem

On Android, the deleteContentBackward and deleteContentForward input types were using the "diff path" — an optimization that batches rapid text changes into a single diff and flushes them later. This works great for insertions, but for deletions the flush sends {type: 'delete', direction: 'forward'} regardless of the original input type. This means any behavior listening for delete.backward or delete.forward never fires.

Fix

Remove the diff path for deleteContentBackward and deleteContentForward entirely. Always use scheduleAction for these input types, which sends the correct delete.backward / delete.forward behavior events.

The diff path remains in use for insertions (insertText, insertCompositionText, etc.) where it works correctly.

Changes

  • android-input-manager.ts: Remove the storeDiff branches from deleteContentBackward and deleteContentForward cases — always use scheduleAction instead
  • Remove unused isDOMSelection import (was only used in the deleted deleteContentBackward diff path)

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 28, 2026

⚠️ No Changeset found

Latest commit: a56a7ed

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 28, 2026

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

Project Deployment Actions Updated (UTC)
portable-text-editor-documentation Ready Ready Preview, Comment Feb 28, 2026 11:26am
portable-text-example-basic Ready Ready Preview, Comment Feb 28, 2026 11:26am
portable-text-playground Ready Ready Preview, Comment Feb 28, 2026 11:26am

Request Review

When deleteContentBackward or deleteContentForward fires on Android, the
Android Input Manager previously stored a text diff instead of scheduling
an action. When the diff was flushed, it sent
{type: 'delete', direction: 'forward'} — NOT delete.backward or
delete.forward. This meant any behavior listening on those specific event
types never fired on Android.

The fix: remove the diff path for deleteContentBackward and
deleteContentForward entirely. Always use scheduleAction for these input
types, which sends the correct delete.backward / delete.forward behavior
events. The diff path remains in use for insertions where it works
correctly.
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