Open masayuki-nakano opened 4 years ago
The spec does not specify what dom change the browser is to do if the event is not canceled. Notice that the browser should emit the event even when the action is not possible in the view of the browser (for example: user hits shortcut keys for bold, but the selection is collapsed).
A user agent MUST agent MUST dispatch [UI-EVENTS] this event when the user has attempted to input in a contenteditable element. It does not necessarily mean the user agent [UI-EVENTS] will then update the DOM.
Given that we do not specify how the browser should modify the DOM is not changed by an event listener, I think it would be consistent to also not specify the behavior if it has been modified. Alternatively, if consistency is desired and it is not too difficult to program, I would say that the DOM should not be modified in this case.
For example,
insertReplacementText
indicates modifying all or partial text in editor. If the replacing text is modified by abeforeinput
event listener, but it's not canceled, what should browsers do? Keep inserting new value at selection afterbeforeinput
event?Similarly, if selection is changed by
beforeinput
event listener when itsinputType
isdelete*
, browsers should keep deleting something with new selection?Currently, nothing is declared by the specs.