DigitalCommons / land-explorer-front-end

React app for the Land Explorer front end
http://landexplorer.cc
GNU Affero General Public License v3.0
1 stars 0 forks source link

[LX] Improve menus on mobile #236

Closed lin-d-hop closed 1 year ago

lin-d-hop commented 1 year ago

Description

In #231 the following issues with menus were uncovered:

Let's fix them :)

image

Acceptance Criteria

ms0ur1s commented 1 year ago

Menu swipe now works fine on staging. In a comparison between live and staging on both tablet and mobile, the problem persists on live (though less so on tablet), but not on staging. Either this was already fixed on staging (an oversight on my part, any further site audits I undertake will include an inspection of both staging and live) or was corrected subsequent to my previous sweep.

However, I did notice the below on tablet. I seem to remember discovering this previously but I missed it from my write-up.

lx-menu-tablet

I can only replicate this on an actual device, however, not it chrome dev tools or using the mobile simulator browser extension.

ms0ur1s commented 1 year ago

Conditional closes added to ProfilePic.js

onClick={() => {
        analytics.event(analytics._event.USER_MENU, "Open");
        dispatch({ type: "TOGGLE_MENU_PROFILE" });
        // Close left pane if mobile and tool is active
        if (activeTool != "" && isMobile) dispatch({ type: "CLOSE_TRAY" });
}}

and LeftPane.js

const clickIcon = (tray) => {
    active === tray
      ? dispatch({ type: "CLOSE_TRAY" })
      : dispatch({ type: "SET_ACTIVE", payload: tray });
    // Close profile menu if open and mobile
    if (profileMenuOpen && isMobile) dispatch({ type: "CLOSE_MENU_PROFILE" });
};
ms0ur1s commented 1 year ago

Resolved using globalEventOff as in below issue: https://github.com/ReactTooltip/react-tooltip/issues/203

ms0ur1s commented 1 year ago

Added a click outside custom hook

ms0ur1s commented 1 year ago

As with the first issue this seem to have been resolved on staging.