theKashey / react-focus-on

🎯 Solution for WAI ARIA compatible modal dialogs or full-screen tasks, you were looking for
MIT License
336 stars 14 forks source link

Click outside should be bound to mousedown / touchstart rather than click / touchend #20

Closed benoitgrelard closed 4 years ago

benoitgrelard commented 4 years ago

Hi @theKashey,

After doing some research, I found another behaviour similar to the work we did on the escape key behaviour (#15).

Similarly here, looking at what the OS does for all types of modal layers (things like save system menus, app menus, right click menus, open selects, etc) click outside always executes instantly as soon as pressing down, on mousedown basically.

I believe we should also bind to mousedown rather than click?

Small change again, but I think offers much better consistency. Let me know your thoughts, I'll send you a PR for it as well in a minute.

Cheers 👍

theKashey commented 4 years ago

Released among v3.1.2

benoitgrelard commented 4 years ago

🙏