0

I have some pages with file browser input. Everything works fine, but to prevent the user to click the Add Files button many times or to click in some another link in the page I want to make only the file browser window clickable (Gmail have this feature when you want to attach some file in the email for example).

I don't want to use

e.preventDefault()

Because when the user choose the file or cancel the file browser I need to enable the button again. So basically I just want to "block" clicks outside of File Browser Window.

Someone have some idea how to do it ?

Deric Lima
  • 1,972
  • 2
  • 24
  • 33
  • Possible duplicate of [How to detect a click outside an element?](http://stackoverflow.com/questions/152975/how-to-detect-a-click-outside-an-element) – Heretic Monkey Sep 21 '16 at 13:40
  • What is the problem with them clicking it many times? Trying to figure out the approach. – epascarello Sep 21 '16 at 13:41
  • @epascarello When he click multiple times the file browser window open more than one time. For example, if he double click two windows will be open, or even he click just once when the window is open he can click and open more than one. – Deric Lima Sep 21 '16 at 13:43
  • you can disabled the button ? – Sunil Kumar Sep 21 '16 at 13:48
  • I can. But when user close the File Browser Window I must enable again.... – Deric Lima Sep 21 '16 at 13:50
  • Is this issue particular to a Browser? I'm sure clicks are blocked by default. see the example https://jsfiddle.net/533akkgq/ When the browse window is open all clicks on the browser window are blocked, tested latest Chrome, FF, IE Edge – r8n5n Sep 21 '16 at 14:03
  • After spending hours looking for a solution, I just realise that there's no callback for cancel button, its up to browser and we cannot control this. So one solution is to create a new Dialog before call the File Browser dialog to control all the clicks. – Deric Lima Sep 21 '16 at 20:07

0 Answers0