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

Add test for pointer-events: none support #80

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

Add test for pointer-events: none support #80

johan opened this issue May 12, 2010 · 16 comments

Comments

@johan
Copy link

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
Copy link
Member

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

@devongovett
Copy link
Contributor

Or the slightly shorter:

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

@paulirish
Copy link
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
Copy link
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
Copy link
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
Copy link
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
Copy link
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
Copy link
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
Copy link

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
Copy link
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
Copy link
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
Copy link
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
Copy link
Member

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
@patavinus
Copy link

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
Copy link
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
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
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants