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

Add test for pointer-events: none support #80

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

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

This comment has been minimized.

Member

paulirish commented May 12, 2010

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

@devongovett

This comment has been minimized.

Contributor

devongovett commented Aug 24, 2010

Or the slightly shorter:

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

This comment has been minimized.

Member

paulirish commented Aug 24, 2010

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

This comment has been minimized.

Member

paulirish commented Nov 2, 2010

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

This comment has been minimized.

Member

paulirish commented Sep 23, 2011

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Member

paulirish commented Oct 5, 2011

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

This comment has been minimized.

Member

paulirish commented Apr 20, 2012

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

This comment has been minimized.

jonathansampson commented Apr 20, 2012

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Member

paulirish commented May 1, 2012

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

paulirish added a commit that referenced this issue May 1, 2012

@paulirish paulirish closed this May 1, 2012

@patavinus

This comment has been minimized.

patavinus commented Feb 28, 2013

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

This comment has been minimized.

Member

stucox commented Mar 1, 2013

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

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015

Merge pull request Modernizr#386 from ausi/master
feature detection for pointer-events - closes Modernizr#80

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015

patrickkettner pushed a commit to patrickkettner/Modernizr that referenced this issue Feb 22, 2015

@sammyhk

This comment has been minimized.

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