1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fixed IE Edge + touch screen and popups

Discussion in 'Resolved Bug Reports' started by Arty, Aug 17, 2015.

  1. Arty

    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.
  2. Arty

    Arty Well-Known Member

    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
          _isTouchBrowserVal = !!('ontouchstart' in window);
    replace with
          _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.
  3. imthebest

    imthebest Formerly Super120

    Arty, you are the best. I think that the XF devs should hire you for consultancy regarding the new XF 2.0 theme.
    Mouth, Jay and Arty like this.
  4. Mike

    Mike XenForo Developer Staff Member

    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.
  5. Arty

    Arty Well-Known Member

    Yes, that's exactly what is happening. Hover intent opens dropdown, click closes it.

Share This Page