Menus can't be closed with Safari

Kirby

Well-known member
Affected version
2.3.6
Steps to reproduce
  1. While being logged in access https://xenforo.com/community with Safari on an iOS / iPadOS device (Tested: Safari 18.5 iPhone SE 2, Safari 18.2.1 iPad 8)
  2. Click on one of the menus in the upper right corner (eg. Account, Direct Messages, Alerts or Search) to open it
  3. After the menu has beep opened click on the icon again to close it
Expected Result
The menu is closed

Actual Result
The linked page (eg. https://xenforo.com/community/account/, etc.) is opened
 
The expected (designed) result is for the linked page to be opened.

It has always worked like this and, although I don't have a device handy to check, that's how it's supposed to work also on Android and other browsers. Therefore I believe the behaviour is consistent across all devices and inputs (touch / keyboard/mouse).
 
I don't have a device handy to check, that's how it's supposed to work also on Android and other browsers.
Are you 100% sure about this?

XF.MenuClick
JavaScript:
click: function(e)
{
    if ((e.ctrlKey || e.shiftKey || e.altKey) && this.$target.attr('href'))
    {
        // don't open the menu as the target will be opened elsewhere
        return;
    }

    var touchTriggered = XF.isEventTouchTriggered(e),
        preventDefault = true;

    if (!touchTriggered && this.isOpen())
    {
        // allow second clicks to the menu trigger follow any link it has
        preventDefault = false;
    }

    if (preventDefault)
    {
        e.preventDefault();
    }

    this.toggle(touchTriggered, XF.NavDeviceWatcher.isKeyboardNav());
},

To me this reads like on touch devices the default action (open link) should explicitly be prevented - and this is the behaviour I get on Android.

This makes a lot of sense to me:
On devices with small screens (like smartphones) it might be quite difficult to find an empty area to trigger a "close tap" to close a menu.
 
Last edited:
Maybe I've been using iOS for too long. The current behaviour might possibly be the way it has always worked on iOS, hence why it feels normal to me, but I accept that the code seems to disagree.

We'll take a look.
 
Back
Top Bottom