Bug 217692 - `beforeinput` event is not fired when selecting an item of autocomplete or password manager
Summary: `beforeinput` event is not fired when selecting an item of autocomplete or pa...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari 14
Hardware: Mac macOS 10.15
: P2 Normal
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2020-10-13 21:31 PDT by Masayuki Nakano
Modified: 2024-05-07 00:30 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Masayuki Nakano 2020-10-13 21:31:55 PDT
1. Go to https://d-toybox.com/studio/lib/input_event_viewer.html
2. Choose "<input type="text">"
3. Submit the form below "Test editor beahvior:"
4. Then, you'll see same page, backspace some characters from the last to show autocomplete suggest.
5. Choose one of the list.

Then, `beforeinput` should be fired when replacing the `<input>`'s value, but only `input` event is fired. You can check it with the table below "Events:".

You can similar thing with password manager with choosing "<input type="password">" at #2.
Comment 1 Radar WebKit Bug Importer 2020-10-14 12:58:30 PDT
<rdar://problem/70304782>
Comment 2 Masayuki Nakano 2020-10-19 17:27:43 PDT
FYI: Firefox will ship `beforeinput` with the following hack because of this WebKit's bug and Blink's same bug (https://bugs.chromium.org/p/chromium/issues/detail?id=1051844).

1. Will fire `beforeinput` event when user uses build-in autocomplete etc.
2. Set its `inputType` to `insertReplacementText` as defined by the spec.
3. But make it not cancelable for protecting Firefox users from web apps which unexpectedly blocks default actions of `insertReplacementText`.

https://phabricator.services.mozilla.com/D93206
Comment 3 sideshowbarker 2024-05-05 22:12:40 PDT
Nakano-san, Do you know if we have any relevant WPT tests for this?
Comment 4 sideshowbarker 2024-05-05 22:14:54 PDT
Nakano-san, Is the Chrome behavior for this case spec-conforming?
Comment 5 Masayuki Nakano 2024-05-07 00:30:26 PDT
(In reply to sideshowbarker from comment #3)
> Nakano-san, Do you know if we have any relevant WPT tests for this?

Unfortunately, there is no WPTs because the test driver does not provide a way to work with browsers' UI like a popup of autocomplete.

(In reply to sideshowbarker from comment #4)
> Nakano-san, Is the Chrome behavior for this case spec-conforming?

No, I filed Chromium bug too.
https://issues.chromium.org/issues/40673974