[Webkit-unassigned] [Bug 281430] New: click events invoked with keyboard have fictitious screenX, screenY, clientX, clientY values
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Oct 14 08:57:50 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=281430
Bug ID: 281430
Summary: click events invoked with keyboard have fictitious
screenX, screenY, clientX, clientY values
Product: WebKit
Version: WebKit Nightly Build
Hardware: All
OS: All
Status: NEW
Severity: Normal
Priority: P2
Component: DOM
Assignee: webkit-unassigned at lists.webkit.org
Reporter: josh.tumath at outlook.com
Problem:
Click events use the MouseEvent class. However, click events can be invoked with keyboards, too.
There is an interoperability issue with how the screenX, screenY, clientX and clientY coordinate values are set in WebKit vs Gecko and Chromium.
- In WebKit, a keyboard invocation sets the coordinate values to be as if the target was clicked in the very centre.
- In Gecko and Chromium, a keyboard invocation sets the coordinate values to 0.
See CodePen for a demo: https://codepen.io/joshtumath/pen/bGXqqZY
Further information:
Gecko and Chromium's solution is advantageous, because it can be used to check if the click event was invoked with a keyboard or pointer. If the event was invoked with a keyboard, a function like this can be used to detect that:
const clickEventHandler = (event) => {
const possiblyInvokedByKeyboard = event.screenX === 0 || event.screenY === 0;
}
In WebKit, there is no other way AFAIK to detect if a click event was invoked by a keyboard.
Expected behaviour:
I expect WebKit to have the same behaviour as Gecko and Chromium.
--
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/20241014/b399e79a/attachment.htm>
More information about the webkit-unassigned
mailing list