Saturday, June 16, 2018

jQuery UI Dialog > Disable Auto Focus > Prevent jQuery UI Dialog From Setting Focus To First Textbox > Disable Auto Focus Of First Input Box > Prevent Auto Scroll To Top Of Dialog Box

There are several problems related to auto focus of jQuery UI Dialog. Some of them are below:

> Opening jQuery Date picker automatically on focus of dialog, because of first element get auto focused.

> If dialog has scrollbar visible, its auto scrolled to top to auto focus first element of dialog.
So to disable auto focus input element inside UI dialog, add the following code before you call dialog. This will clear out the autofocus code.
$.ui.dialog.prototype._focusTabbable = function(){};

1 comment:

  1. Simply brilliant. I've been searching for a way to disable this feature for years. Thanks!

    ReplyDelete