NEW 271694
MouseEvent offsetX and offsetY should be relative to padding edge
https://bugs.webkit.org/show_bug.cgi?id=271694
Summary MouseEvent offsetX and offsetY should be relative to padding edge
Jonathan Heathcote
Reported 2024-03-26 00:07:07 PDT
Created attachment 470601 [details] Demo showing mouse offset coordinates from MouseMove on an element with a thick border. Observed in Epiphany 45.3 on Arch Linux. MouseEvent events include offsetX and offsetY values which should be relative to the border box of the event target (see spec: https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsetx). In WebKit, however, offsetX/Y coordinates appear to be relative to the border box. The attached demo page shows the clientX/Y values when the mouse is moved over a div. When moving the mouse over the thick black border, negative values should be shown (see Firefox and Chromium for correct examples) however positive values are shown instead in WebKit. NB: this appears to be similar (but different) to bug #218117 (MouseEvent.offsetX/Y returns wrong value for inline elements) since this issue relates to block elements and it seems coordinates come relative to the border box, not the padding box.
Attachments
Demo showing mouse offset coordinates from MouseMove on an element with a thick border. (325 bytes, text/html)
2024-03-26 00:07 PDT, Jonathan Heathcote
no flags
Alexey Proskuryakov
Comment 1 2024-03-26 08:51:33 PDT
Reproduces in Safari too
Radar WebKit Bug Importer
Comment 2 2024-04-02 00:08:13 PDT
Note You need to log in before you can comment on or make changes to this bug.