Skip to content

Keep native browser behavior for prevented beforeinput events #161

Description

@Comandeer

Sometimes user input is connected with a native browser/OS behavior, e.g.

  • pressing Enter inserts a new line and triggers autocorrection,
  • double pressing space inserts a period.

However, RTEs often want to prevent the beforeinput events to be able to customize the input, e.g. preventing beforeinput after pressing Enter to insert a new paragraph. Such prevention disables the native browser behavior. There should be a way to keep the behavior but without the input, e.g.

  • pressing Enter does not insert a new line but triggers autocorrection,
  • double pressing space insert a period regardless of how many beforeinput events have been prevented.

Some loose ideas of how such API could work:

  • a new parameter to the event.preventDefault() to allow native behavior – event.preventDefault( { behavior: true } ),
  • a new method on the event to prevent only input – event.preventInput(),
  • a new method on the event to trigger native behavior manually – event.fireConnectedBehavior().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions