Browse Source
Merge pull request #23005 from abpframework/modal-manager
Place the cursor at the end after the element receives focus.
pull/23033/head
Yağmur Çelik
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
10 additions and
2 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js
|
|
|
@ -104,6 +104,7 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
var focusElement = null; |
|
|
|
if (!options.focusElement) { |
|
|
|
//focuses first element if it's a typeable input.
|
|
|
|
var $firstVisibleInput = _$modal.find('input:not([type=hidden]):first'); |
|
|
|
@ -120,11 +121,18 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f |
|
|
|
} |
|
|
|
|
|
|
|
$firstVisibleInput.focus(); |
|
|
|
focusElement = $firstVisibleInput; |
|
|
|
} else if (typeof options.focusElement === 'function') { |
|
|
|
var focusElement = options.focusElement(); |
|
|
|
focusElement = options.focusElement(); |
|
|
|
focusElement.focus(); |
|
|
|
} else if (typeof options.focusElement === 'string') { |
|
|
|
$(options.focusElement).focus(); |
|
|
|
focusElement = $(options.focusElement); |
|
|
|
focusElement.focus(); |
|
|
|
} |
|
|
|
|
|
|
|
if (focusElement && $(focusElement).is('input')) { |
|
|
|
var value = focusElement.val(); |
|
|
|
focusElement[0].setSelectionRange(value.length, value.length); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|