← Back to release summary

InputEvent types for deletion commands on non-collapsed selections

Category
Miscellaneous
Type
No developer-visible change
Status
Proposed (Chrome Proposed)
Intent stage
None

Summary

Reports accurate inputType values for deletion keyboard shortcuts on selected text. When deletion commands like Ctrl+Backspace or Ctrl+Delete are used with selected text in contenteditable elements, the beforeinput and input events now report deleteContentBackward or deleteContentForward instead of deleteWordBackward or deleteWordForward. This enables web developers to correctly understand what editing operation occurred and implement reliable undo/redo or custom editing behaviors.

Motivation

Currently, deletion keyboard shortcuts like Ctrl+Backspace in contenteditable elements always report deleteWordBackward in beforeinput and input events, even when deleting selected text. The W3C Input Events specification requires deleteContentBackward for non-collapsed selections and deleteWordBackward only for collapsed selections (caret with no selection). This change aligns Chrome with the specification by reporting deleteContentBackward/Forward when text is selected and deleteWordBackward/Forward when operating at a caret position.

Standards & signals

View on chromestatus.com