Skip to content

Mobile: Network selector doesn't close on the second click #6603

@crutch12

Description

@crutch12

Description
A clear and concise description of what the bug is.

How to Reproduce
Steps to reproduce the behavior:

  1. Go to https://swap.cow.fi/
  2. Switch to mobile mode (screen width <960px)
  3. Click Network Selector
  4. Click Network Selector again

Actual behavior
Network Selection closes and opens again

Expected behavior
Network Selection should be closed on Network Selector click (4)

Additional context
It works fine on desktop.

It happens because of useOnClickOutside(isUpToMedium ? [nodeMobile] : [node]. On mobile we detect (4) click as "outside" click, so it closes FlyoutMenu. And opens it again because of "onClick" triggers "toggle".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions