Bug 206341

Summary: [GTK] Missing onbeforeinput or extra oninput in certain case
Product: WebKit Reporter: Milan Crha <mcrha>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bugs-noreply
Priority: P2    
Version: Other   
Hardware: Unspecified   
OS: Unspecified   

Description Milan Crha 2020-01-16 01:43:17 PST
As far as I know, every oninput event should be preceded by onbeforeinput, or at least things like entering text and deleting it should do that. I found out a case, where it is not done, the onbeforeinput is missing or the oninput is invoked in error.

Steps:
a) open MiniBrowser in editor mode:

   $ MiniBrowser --editor-mode

b) open the Web Inspector and execute in the JavaScript console these two commands:

   document.body.onbeforeinput = function(event) { console.log("before input:" + event.inputType); };
   document.body.oninput = function(event) { console.log("input:" + event.inputType); };

c) click with the mouse to the window body
d) press these keys: <Enter><Backspace>

   The console should show:

      before input:insertParagraph
      input:insertParagraph
      before input:deleteContentBackward
      input:deleteContentBackward

   So far so good.

d) press this key once: <Backspace>

   While there should be added to the console:

      before input:deleteContentBackward
      input:deleteContentBackward

   there's only added:

      input:deleteContentBackward

   thus the onbeforeinput invocation is missing.

Pressing <Backspace> again doesn't invoke onbeforeinput, neither oninput, as expected.