w3c / w3c/editing

Should beforeinput and input always come together?

Open
#248 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

InputEvents
Dominant language
HTML
Stars
202
Forks
43
PR merge metrics
No merged PRs in 30d

Description

The Input Events specification [1] currently reads:

Input events are sent before (beforeinput event) and after (input event) a user attempts to edit the markup.

The UI Events specification [2] currently says on beforeinput:

A user agent MUST dispatch this event when the DOM is about to be updated.

Notice the word "attempts" - which can be read as that these events should be triggered if the user attempts to do something even if that something is impossible (such as undo when the undo stack is empty). This formulation seems to say that each beforeinput event should be followed by an input event - unless the beforeinput event has been cancelled.

Testing of the implementation Chrome shows that it has been implemented differently. Beforeinput events for actions that cannot actually be executed are not followed by an input event. See https://wpt.fyi/results/input-events/input-events-typing.html?label=experimental&label=master&aligned

The question is: Do we want the current behavior or do we want beforeinput/input to always come in pairs?

[1] https://w3c.github.io/input-events/#events-inputevents

[2] https://www.w3.org/TR/uievents/#events-input-types

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the Input Events and UI Events specification sections linked in the issue with the behavior shown by the WPT input-events/input-events-typing.html results. Decide whether impossible editing attempts should produce paired beforeinput and input events, then update the relevant specification wording and verify that it matches the intended behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.