Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How browsers should handle default action of beforeinput event if it's NOT canceled by modified editor contents #106

Open
masayuki-nakano opened this issue Dec 23, 2019 · 1 comment

Comments

@masayuki-nakano
Copy link

For example, insertReplacementText indicates modifying all or partial text in editor. If the replacing text is modified by a beforeinput event listener, but it's not canceled, what should browsers do? Keep inserting new value at selection after beforeinput event?

Similarly, if selection is changed by beforeinput event listener when its inputType is delete*, browsers should keep deleting something with new selection?

Currently, nothing is declared by the specs.

@johanneswilm
Copy link
Contributor

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.

xeonchen pushed a commit to xeonchen/gecko that referenced this issue Jan 14, 2020
…vent if there is no `TextEditor` r=smaug

If `TextControlState` does not have `TextEditor` and its `SetValue()` is called
from `SetUserInput()`, `TextControlState` itself needs to dispatch `beforeinput`
event.

If the value is modified by `beforeinput` event listener, it's intended that
`preventDefault()` is called by the web apps.  However, the behavior in this
case is not mentioned by UI Events nor Input Events spec.  We should just file
a spec issue instead of emulating Chrome's behavior for now because it requires
more changes, but this case must be an edge case.
The spec issue is: w3c/input-events#106

Differential Revision: https://phabricator.services.mozilla.com/D58126
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Jan 14, 2020
…vent if there is no `TextEditor` r=smaug

If `TextControlState` does not have `TextEditor` and its `SetValue()` is called
from `SetUserInput()`, `TextControlState` itself needs to dispatch `beforeinput`
event.

If the value is modified by `beforeinput` event listener, it's intended that
`preventDefault()` is called by the web apps.  However, the behavior in this
case is not mentioned by UI Events nor Input Events spec.  We should just file
a spec issue instead of emulating Chrome's behavior for now because it requires
more changes, but this case must be an edge case.
The spec issue is: w3c/input-events#106

Differential Revision: https://phabricator.services.mozilla.com/D58126

--HG--
extra : moz-landing-system : lando
xeonchen pushed a commit to xeonchen/gecko that referenced this issue Jan 14, 2020
…vent if there is no `TextEditor` r=smaug

If `TextControlState` does not have `TextEditor` and its `SetValue()` is called
from `SetUserInput()`, `TextControlState` itself needs to dispatch `beforeinput`
event.

If the value is modified by `beforeinput` event listener, it's intended that
`preventDefault()` is called by the web apps.  However, the behavior in this
case is not mentioned by UI Events nor Input Events spec.  We should just file
a spec issue instead of emulating Chrome's behavior for now because it requires
more changes, but this case must be an edge case.
The spec issue is: w3c/input-events#106

Differential Revision: https://phabricator.services.mozilla.com/D58126
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Jan 14, 2020
…vent if there is no `TextEditor` r=smaug

If `TextControlState` does not have `TextEditor` and its `SetValue()` is called
from `SetUserInput()`, `TextControlState` itself needs to dispatch `beforeinput`
event.

If the value is modified by `beforeinput` event listener, it's intended that
`preventDefault()` is called by the web apps.  However, the behavior in this
case is not mentioned by UI Events nor Input Events spec.  We should just file
a spec issue instead of emulating Chrome's behavior for now because it requires
more changes, but this case must be an edge case.
The spec issue is: w3c/input-events#106

Differential Revision: https://phabricator.services.mozilla.com/D58126

--HG--
extra : moz-landing-system : lando
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Jan 16, 2020
…vent if there is no `TextEditor` r=smaug

If `TextControlState` does not have `TextEditor` and its `SetValue()` is called
from `SetUserInput()`, `TextControlState` itself needs to dispatch `beforeinput`
event.

If the value is modified by `beforeinput` event listener, it's intended that
`preventDefault()` is called by the web apps.  However, the behavior in this
case is not mentioned by UI Events nor Input Events spec.  We should just file
a spec issue instead of emulating Chrome's behavior for now because it requires
more changes, but this case must be an edge case.
The spec issue is: w3c/input-events#106

Differential Revision: https://phabricator.services.mozilla.com/D58126

UltraBlame original commit: 1fb9cf2264b668a76d3671a5a3b06f67c587c0c0
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Jan 16, 2020
…vent if there is no `TextEditor` r=smaug

If `TextControlState` does not have `TextEditor` and its `SetValue()` is called
from `SetUserInput()`, `TextControlState` itself needs to dispatch `beforeinput`
event.

If the value is modified by `beforeinput` event listener, it's intended that
`preventDefault()` is called by the web apps.  However, the behavior in this
case is not mentioned by UI Events nor Input Events spec.  We should just file
a spec issue instead of emulating Chrome's behavior for now because it requires
more changes, but this case must be an edge case.
The spec issue is: w3c/input-events#106

Differential Revision: https://phabricator.services.mozilla.com/D58126

UltraBlame original commit: 2dbb6572374cd021f7727c3ffdd0c4251b3731fb
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Jan 16, 2020
…vent if there is no `TextEditor` r=smaug

If `TextControlState` does not have `TextEditor` and its `SetValue()` is called
from `SetUserInput()`, `TextControlState` itself needs to dispatch `beforeinput`
event.

If the value is modified by `beforeinput` event listener, it's intended that
`preventDefault()` is called by the web apps.  However, the behavior in this
case is not mentioned by UI Events nor Input Events spec.  We should just file
a spec issue instead of emulating Chrome's behavior for now because it requires
more changes, but this case must be an edge case.
The spec issue is: w3c/input-events#106

Differential Revision: https://phabricator.services.mozilla.com/D58126

UltraBlame original commit: 1fb9cf2264b668a76d3671a5a3b06f67c587c0c0
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Jan 16, 2020
…vent if there is no `TextEditor` r=smaug

If `TextControlState` does not have `TextEditor` and its `SetValue()` is called
from `SetUserInput()`, `TextControlState` itself needs to dispatch `beforeinput`
event.

If the value is modified by `beforeinput` event listener, it's intended that
`preventDefault()` is called by the web apps.  However, the behavior in this
case is not mentioned by UI Events nor Input Events spec.  We should just file
a spec issue instead of emulating Chrome's behavior for now because it requires
more changes, but this case must be an edge case.
The spec issue is: w3c/input-events#106

Differential Revision: https://phabricator.services.mozilla.com/D58126

UltraBlame original commit: 2dbb6572374cd021f7727c3ffdd0c4251b3731fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants