Case ce-0043 · Scenario scenario-beforeinput-support

beforeinput event is not supported in Safari

OS: macOS Ubuntu 22.04 Device: Desktop or Laptop Any Browser: Safari 120.0 Keyboard: US Status: draft
beforeinput events safari compatibility

Phenomenon

The beforeinput event, which is crucial for intercepting and modifying input before it’s committed to the DOM, is not supported in Safari. This makes it difficult to implement custom input handling that works across all browsers.

Reproduction example

  1. Create a contenteditable div.
  2. Add an event listener for the beforeinput event.
  3. Type some text.
  4. Observe whether the beforeinput event fires.

Observed behavior

  • In Safari on macOS, the beforeinput event does not fire.
  • Event listeners for beforeinput are never called.
  • Alternative approaches must be used, but they are less reliable.

Expected behavior

  • The beforeinput event should be supported in all modern browsers.
  • The event should fire before input is committed to the DOM.
  • It should provide a way to prevent or modify the default input behavior.

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: macOS Ubuntu 22.04
Device: Desktop or Laptop Any
Browser: Safari 120.0
Keyboard: US
Your environment

Use this editable area to reproduce the described case.

Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.