Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cssom-view] MouseEvent.offsetX/offsetY not defined for SVG layout elements #1508

Open
AmeliaBR opened this issue Jun 8, 2017 · 1 comment

Comments

@AmeliaBR
Copy link
Contributor

AmeliaBR commented Jun 8, 2017

The definition of MouseEvent.offsetX/Y is:

The offsetX[Y] attribute must follow these steps:

  1. If the event’s dispatch flag is set, return the x[y]-coordinate of the position where the event occurred relative to the origin of the padding edge of the target node, ignoring the transforms that apply to the element and its ancestors, and terminate these steps.
  2. Return the value of the event’s pageX[Y] attribute.

Which doesn't give any guidance for what to do when the event target is an SVG layout element, and doesn't have its own padding edge. Firefox seems to use the bounding box of the SVG element (and the local user-space coordinate system). Other browsers seem to use the padding-box of the nearest ancestor <svg> with CSS box layout, and the outside coordinate system for that element (i.e., not including any viewBox scaling). (Firefox does the same when the event target is an <svg> element that has CSS layout boxes.)

For what it's worth: the Firefox behavior is much more useful when working with SVG. But it seems that the cowpath is more heavily-trodden in the other direction.

More generally: reading that definition, I have no idea how "ignoring the transforms" is supposed to be interpreted. Use the local coordinate system or use the document coordinate system?

@emilio
Copy link
Collaborator

emilio commented Jan 5, 2021

I'm changing Gecko's behavior to match other browsers in https://bugzilla.mozilla.org/show_bug.cgi?id=1684973. Sadface, as I think Firefox's behavior is more useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants