From 7ee60ed51cf2f0c88d7d3fe7f0415b72dd9a92d4 Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Wed, 23 Oct 2019 15:24:38 +0300 Subject: [PATCH] focus first typeable element. except pickers eg: this is for preventing: "datepicker flashes immediately right after modal shows." --- .../bootstrap/modal-manager.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js index 5d55837b84..7da3a835d0 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js @@ -94,7 +94,10 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f }); _$modal.on('shown.bs.modal', function () { - _$modal.find('input:not([type=hidden]):first').focus(); + //focuses first typeable element. + _$modal + .find('input[type=text]:not(.datepicker),input[type=password],input[type=email],input[type=number],input[type=search],input[type=tel],input[type=url]:first') + .focus(); }); var modalClass = abp.modals[options.modalClass];