Bug 218117

Summary: MouseEvent.offsetX/Y returns wrong value for inline elements
Product: WebKit Reporter: Noam Rosenthal <noam>
Component: UI EventsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: nige.animal, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=271694

Description Noam Rosenthal 2020-10-23 01:13:04 PDT
According to spec (https://drafts.csswg.org/cssom-view/#dom-mouseevent-offsetx), offsetX/offsetY should return the values relative to the element's padding edge.
Firefox does this correctly, WebKit (and also Chromium, currently), return the value relative to the nearest block ancestor. 

See https://codepen.io/noamr-the-selector/pen/WNxRbmZ
Comment 1 Noam Rosenthal 2020-10-23 01:18:56 PDT
Corresponding Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1141782
Comment 2 Noam Rosenthal 2020-10-23 01:21:01 PDT
Relevant WPT issue: https://github.com/web-platform-tests/wpt/issues/15089
Comment 3 Radar WebKit Bug Importer 2020-10-30 01:13:58 PDT
<rdar://problem/70857665>
Comment 4 Nige White 2022-11-24 01:45:47 PST
This is now fixed on Blink. Safari is the outlier.


This is why we can't have nice things.

We will always need some kind of library to abstract away these browser differences.