Whilst implementing a modal dialog using react-focus-on I have realised that the onClickOutside callback doesn't get triggered on iOS (possibly all touch devices?)
I have done some investigation and I saw that the lib attaches a click handler on the document in Effect.tsx (here).
However, after some investigation, it appears iOS doesn't trigger any click events on nodes unless they "look" clickable (see this comment).
I have a fix for it (basically attaching a touchstart handler on top of the click handler).
I will send you a PR and we can continue the discussion there.
Hi @theKashey,
Whilst implementing a modal dialog using
react-focus-on
I have realised that theonClickOutside
callback doesn't get triggered on iOS (possibly all touch devices?)I have done some investigation and I saw that the lib attaches a
click
handler on thedocument
in Effect.tsx (here).However, after some investigation, it appears iOS doesn't trigger any
click
events on nodes unless they "look" clickable (see this comment).I have a fix for it (basically attaching a
touchstart
handler on top of theclick
handler). I will send you a PR and we can continue the discussion there.✌️