[Webkit-unassigned] [Bug 220723] New: Page scrolls when dispatching space keypress event from an input field

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 19 00:52:14 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=220723

            Bug ID: 220723
           Summary: Page scrolls when dispatching space keypress event
                    from an input field
           Product: WebKit
           Version: Safari 14
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: DOM
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: mats at mankz.com

When pressing space key inside a textfield, no page scroll is observed. Should work the same for untrusted events, test case below:

Open any page with an input on it, such as: https://bugs.webkit.org/ 


Run this in the console:

const input = $('input[type=text]'); // grab first input on the page

const event = new KeyboardEvent('keypress', {
altKey: false,
bubbles: true,
cancelBubble: false,
cancelable: true,
charCode: 32,
code: "Space",
composed: true,
ctrlKey: false,
currentTarget: null,
defaultPrevented: false,
detail: 0,
eventPhase: 0,
isComposing: false,
key: " ",
keyCode: 0,
location: 0,
metaKey: false,
repeat: false,
returnValue: true,
shiftKey: false,
srcElement: input,
target: input,
type: "keypress",
which: 0
});

input.focus();
input.dispatchEvent(event);

Note that page scrolls.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210119/d6759170/attachment.htm>


More information about the webkit-unassigned mailing list