0

There is a global document click event(React hook useClickAway). But when you click on a slide, the event does not fire About example: circle in header, like avatar dropdown, click on it trigger menu. Menu closes if you click anywhere outside. How to close menu without hacks, when click to swiper slide too? Codesandbox example

Dharman
  • 30,962
  • 25
  • 85
  • 135
Artur13
  • 21
  • 4

2 Answers2

0

prop touchStartPreventDefault={false} is solution

Artur13
  • 21
  • 4
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 24 '22 at 08:54
0

Try setting the allowTouchMove prop to false in your swiper settings.

By default, the prop is set to true to allow the movement of swiper slides by dragging and preventing any other unwanted click propagation making document clicks not fire.

Changing it to false may prevent dragging to move the swiper slide but it solves the issue. Check docs here