Add test for pointer-events: none support #80

Closed
johan opened this Issue May 12, 2010 · 16 comments

Projects

None yet

8 participants

@johan
johan commented May 12, 2010

http://demos.hacks.mozilla.org/openweb/pointer-events/ is great for opacity gradients on top of trailing-off content without swallowing up mouse events, but on browsers not handling pointer-events: none, it hampers functionality. Could we get a test for this support?

@paulirish
Member

good call. in the meantime, here's how you can have it:
Modernizr.addTest('pointerevents',function(){
return document.documentElement.style.pointerEvents === '';
})

@devongovett

Or the slightly shorter:

Modernizr.addTest('pointerevents',function(){
    return 'pointerEvents' in document.documentElement.style;
})
@paulirish
Member

Yeah in general i see the in test succeeding the same as the === '' test, but IE9 had a few things that in tests passed but failed in reality..

So ... i prefer in but I'll be watching for where the results differ. :)

@paulirish
Member

closing this ticket for now.. we're linking it up on the wiki:
http://github.com/Modernizr/Modernizr/wiki/Home/

thanks everyone. this'll go into the Modernizr 2.0 ecosystem of tests... somehow. :)

@paulirish paulirish reopened this Sep 23, 2011
@paulirish
Member

mr @ryanseddon pointed out that @ausi has written a pointer-events test that doesnt false positive (i think its because of SVG pointer-events support but lacking the CSS side of things)

https://github.com/ausi/Feature-detection-technique-for-pointer-events/blob/master/modernizr-pointerevents.js

I'd love to get this added to /feature-detects/ and I'm also curious if we could also change document.defaultView to a window reference.

@ausi
ausi commented Sep 23, 2011

i replaced the document.defaultView with a window reference, but my script is currently only tested in a few browsers (see https://github.com/ausi/Feature-detection-technique-for-pointer-events/wiki )

maybe you should wait until it's tested better.

@paulirish paulirish closed this in d4bfec6 Oct 5, 2011
@paulirish
Member

ausi it turns out you can use window's getCompuedStyle except when going cross-frame in ff3.6
that's the only time you need to use d.dV
but luckily we dont have that problem here.

just FYI.. anyway closed this issue as I merged ausi's PR. cheers.

@paulirish paulirish reopened this Apr 20, 2012
@paulirish
Member

pointer-events needs more testing. It's false positiving in IE9 due to pointer-events on SVG support (I believe).

I've removed the existing test from the repo.

We've tried to do p-e tests in #386 and #556. And #519 pointed out the naive test will false positive in Opera.

Does someone want to take on defining the best test here? This needs a more thorough look. cc @helgri @ausi

@jonathansampson

IE10 also renders false positives as pointer-events are present, and even retain valid values, yet don't function on HTML elements. Support is there for SVG, as Paul suggested.

@ausi
ausi commented Apr 20, 2012

I can not confirm false positives in IE9 or Opera. Both browsers do not support pointer-events for CSS/HTML.
http://caniuse.com/pointer-events

On this page you can test the support by clicking the box in the middle:
http://ausi.github.com/Feature-detection-technique-for-pointer-events/
it will also tell you if my test detected it correctly.

A list of browsers where i tested my script: https://github.com/ausi/Feature-detection-technique-for-pointer-events/wiki

@ausi
ausi commented Apr 21, 2012

should we rename the test to pointerevents-html to make clear this test is for testing the html support?

@ausi
ausi commented Apr 30, 2012

@paulirish what can i do to get this test back to the Modernizr feature-detects?
I don't see any problems with my test in any browser.

@paulirish
Member

Yeah I'm not sure why I got so confused here. my bad, ausi.

@paulirish paulirish added a commit that referenced this issue May 1, 2012
@paulirish paulirish Revert "remove pointer events test as it's not reliable. ref #80"
It's totally fine.

This reverts commit 284a859.
db2a1f8
@paulirish paulirish closed this May 1, 2012
@patavinus

i tested with HTC TITAN (windows phone 7.5) and give me an INCOMPATIBILITY with pointer-events. But i think it's a false positive, because it worked in my website. How can i solve this issue?

@stucox
Member
stucox commented Mar 1, 2013

@patavinus - Could you open a new issue and provide a Codepen (or similar) which reproduces the problem?

@patrickkettner patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015
@paulirish paulirish remove pointer events test as it's not reliable. ref #80 63a36a2
@patrickkettner patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015
@paulirish paulirish Revert "remove pointer events test as it's not reliable. ref #80"
It's totally fine.

This reverts commit 284a859.
e1c44f6
@sammyhk
sammyhk commented Feb 27, 2015

Hi All,
Apart from the the false positive result in browsers, the detection code using getComputedStyle().pointerEvents which will cause JS error because getComputedStyle() return null in Firefox for some reason due to the bug https://bugzilla.mozilla.org/show_bug.cgi?id=795520 and https://bugzilla.mozilla.org/show_bug.cgi?id=548397

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