-
Notifications
You must be signed in to change notification settings - Fork 132
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
Remove un-implemented pointer-events
"painted" rules for images
#322
Comments
I suspect that this was mostly because the spec has a somewhat ambiguous reading:
I think the original author was probably referring to the fact that some values ("visiblePainted" and "painted") require pixel level hit testing, and some don't. The former options include the the text:
whereas the remaining options talk about:
A loose reading of the introductory paragraph could be interpreted to mean that implementations had a choice whether to use pixels or not. I hope the spec doesn't get changed to remove the per-pixel options. If it doesn't, then perhaps the intro should be modified to remove any ambiguity. Browser bug reports for this issue here: |
This issue has popped up on Stack Overflow a few times recently. People expect transparent pixels to be transparent to clicks. Currently, the only way to get the expected behaviour is to use a |
Not blocking updated 2.0 CR publication - assigning 2.1 WD milestone |
Example for pointer events and Example for pointer events and The clipping is taken into account for hit testing, masking is not. Same behaviour in Firefox, Chrome and WebKit. |
|
…requirement to scan raster image pixels. #322
It does. In your test (https://codepen.io/krit/pen/OaXzQe) you have |
@fsoder Thanks! Updated the codepen. |
The SVG Working Group just discussed
The full IRC log of that discussion<myles> TOPIC: Remove un-implemented `pointer-events` "painted" rules for images<myles> GitHub: https://github.com//issues/322 <myles> krit: This is about the part of pointer events for raster images. I don't know why it's specific to raster images. ANyway, the spec says you look at the pixels inside the raster image and check the transparency. If the pixel is transparent, it isn't considered in the image for pointer events. Suggestion: Drop this requirement because it's not implemented anywhere <myles> AmeliaBR: It's not implemented anywhere, that's the deciding factor. The reason it's not implemented is because of security concerns, not wanting script to be able to access the pixel data of an image that might be cross origin. <myles> krit: it's a good excuse. <myles> AmeliaBR: The main thing it comes down to: It's not implemented, it's not consistent with HTML, and I can't see anyone out there relying on it because there aren't really any other interactive implementations other than browsers <myles> krit: Proposal: Just rely on the bounding box of the element. I made a pull request to just remove the spec text about transparent pixels <myles> AmeliaBR: I haven't looked at the PR, but it sounds good <myles> RESOLVED: Image pixel data isn't used for hit testing |
The
pointer-events
definition contains detailed rules for "raster images" (presumably, any image embedded with<image>
). A key feature is that an image should only be considered "painted" in areas where it doesn't have full transparency.There are two problems with this:
Based on my testing (CodePen demo) browsers treat an
<image>
element with transparent regions as interactive over its full rectangular dimensions, regardless of whether the image is same or cross-origin.The text was updated successfully, but these errors were encountered: