Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix select input and number input focusing after opening modal

dominik-zeglen2d8999cd0da8
diff --git a/saleor/static/dashboard/js/components/modal.js b/saleor/static/dashboard/js/components/modal.js
index 843450076d..aa298b8139 100644
--- a/saleor/static/dashboard/js/components/modal.js
+++ b/saleor/static/dashboard/js/components/modal.js
@@ -1,6 +1,12 @@
import {initSelects} from './utils';
import SVGInjector from 'svg-injector-2';
+const focusInputs = [
+ 'textarea',
+ 'input[type="text"]:not(.select-dropdown)',
+ 'input[type="number"]'
+];
+
export default $(document).ready((e) => {
$('body').on('click', '.modal-trigger-custom', function (e) {
let that = this;
@@ -12,7 +18,7 @@ export default $(document).ready((e) => {
$modal.html(response);
initSelects();
$modal.modal('open');
- $modal.find('textarea, input[type="text"]')[0].focus();
+ $modal.find(focusInputs.join(','))[0].focus();
// Image checkbox selector
$('.image_select-item-overlay').on('click', function (e) {
let id = $(e.target).attr('id');