Fixed IE Edge + touch screen and popups

Arty

Well-known member
There is a bug with XenForo popups in IE Edge with touch screen: clicking popup control opens popup and immediately closes it, as if it was clicked twice.

You can see it by clicking any popup link in default style without any add-ons. Easiest way to test is to click sub-forums arrow below "XenForo Suggestions" forum on this very forum. It will open for a second then close.
 
Found what's causing it and solution. Problem is XenForo doesn't detect computer as touch screen, even though it has touch screen, so XenForo.PopupMenu toggles menu on mouseover event.

IE doesn't use touchstart event, therefore current detection doesn't work. However IE has navigator.maxTouchPoints property with value 0 for devices without touch screen and above 0 (10 on my laptop) for device with touch screen. IE Edge uses unprefixed property, old IE uses prefixed property.

Solution: in xenforo.js find
Code:
      _isTouchBrowserVal = !!('ontouchstart' in window);
replace with
Code:
      _isTouchBrowserVal = !!('ontouchstart' in window || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
Tested with IE Edge on touch screen, IE11 and Edge without touch screen. navigator.maxTouchPoints works with Edge and IE11, navigator.msMaxTouchPoints works with IE11 and possibly IE10.
 
I don't have a specific setup to test this, but I can confirm that touch wasn't being detected in IE Mobile for the same reason, so I'm applying this change to catch that as well.

That said, I'm surprised this is triggering like this given that IE11 doesn't trigger like this, even without the proper detection. It must be related to hover intent firing before the click event.
 
Back
Top Bottom