Hi,
I have a requirement to disable all user input while a request is processing. So show a mask over the entire page to prevent the user from clicking on it.
However, I still need to block the user from typing on the controls under the mask when the focus already is in some control.
So what I do is:
$(document).on("keydown keypress keyup", false);
This works on most controls, except the webdropdown, whic stills allows me to change selection with the arrow keys while the screen is supposedly disabled. This is a problem, as they are autopostback and allow me to chain many requests at once.
Why is it still responding if I just disabled the keyboard for the whole document?
Thanks in advance.
Best Regards.
Hello,
Yes, in fact I have implemented a "loading" mask that prevented mouse interaction, but the problem was that even itf the mask was on, if the focus was on an input underneath the mask you could still interact with the keyboard.
Thanks for looking into it.
Best regards.
Thank you for the sample and details.
In case you have trouble implementing it using the current approach, and it seems you are actually implementing something like modal dialog/ loading indicator/mask, I suggest to use a modal dialog, which disables any other user interaction until one is made with the dialog itself. Hiding the dialog when the request is complete could be an option as well.
In case you would like to use the igDialog as Modal Dialog, refer to the following sample when the modal option is used and it prevents further user interaction:
http://igniteui.com/dialog-window/modal-dialog
Keep in mind, modal functionality is not supported when dialog is minimized or pinned, because that will trigger misbehavior.
http://help.infragistics.com/jQuery/2015.1/ui.igDialog#options:modal
Additionally, it could be possible to use Window confirm() Method and a timeout
However, please notice our IgniteUI igDialog is a jQuery widget, and it is not inbuilt in the browsers functionality as confirm dialog is. Bearing this in mind, the developer using the widget could hardly enforce the same exact functionality to the user. What is more, please notice the confirm dialog disables the user from interacting and even closing the current tab being used.
Had to bind also to:
$('input').on("keydown keypress keyup", false);
This way it also disables the WebDropDown.
Still don't understand how it doesn't work with $(document). The input is inside the document after all...