Skip to content

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

Focus first input or text in modal after opening

dominik-zeglen099ae571d075
diff --git a/saleor/dashboard/order/forms.py b/saleor/dashboard/order/forms.py
index b39969ee59..b6f3d90667 100644
--- a/saleor/dashboard/order/forms.py
+++ b/saleor/dashboard/order/forms.py
@@ -22,10 +22,9 @@ class OrderNoteForm(forms.ModelForm):
class Meta:
model = OrderNote
fields = ['content']
- widgets = {'content': forms.Textarea({
- 'rows': 5,
- 'placeholder': pgettext_lazy(
- 'Order note form placeholder', 'Note')})}
+ widgets = {
+ 'content': forms.Textarea()
+ }
def __init__(self, *args, **kwargs):
super(OrderNoteForm, self).__init__(*args, **kwargs)
@@ -154,7 +153,6 @@ class MoveItemsForm(forms.Form):
class CancelItemsForm(forms.Form):
-
def __init__(self, *args, **kwargs):
self.item = kwargs.pop('item')
super(CancelItemsForm, self).__init__(*args, **kwargs)
@@ -251,7 +249,6 @@ class CancelGroupForm(forms.Form):
class CancelOrderForm(forms.Form):
-
def __init__(self, *args, **kwargs):
self.order = kwargs.pop('order')
super(CancelOrderForm, self).__init__(*args, **kwargs)
@@ -270,7 +267,6 @@ class CancelOrderForm(forms.Form):
class RemoveVoucherForm(forms.Form):
-
def __init__(self, *args, **kwargs):
self.order = kwargs.pop('order')
super(RemoveVoucherForm, self).__init__(*args, **kwargs)
@@ -294,13 +290,14 @@ class RemoveVoucherForm(forms.Form):
ORDER_STATUS_CHOICES = [
- ('', pgettext_lazy('Order status field value', 'All'))
-] + OrderStatus.CHOICES
-
+ ('', pgettext_lazy('Order status field value', 'All'))
+ ] + OrderStatus.CHOICES
PAYMENT_STATUS_CHOICES = [
- ('', pgettext_lazy('Payment status field value', 'All')),
-] + PaymentStatus.CHOICES
+ (
+ '',
+ pgettext_lazy('Payment status field value', 'All')),
+ ] + PaymentStatus.CHOICES
class OrderFilterForm(forms.Form):
diff --git a/saleor/static/dashboard/js/components/modal.js b/saleor/static/dashboard/js/components/modal.js
index 5d15fb506f..843450076d 100644
--- a/saleor/static/dashboard/js/components/modal.js
+++ b/saleor/static/dashboard/js/components/modal.js
@@ -12,6 +12,7 @@ export default $(document).ready((e) => {
$modal.html(response);
initSelects();
$modal.modal('open');
+ $modal.find('textarea, input[type="text"]')[0].focus();
// Image checkbox selector
$('.image_select-item-overlay').on('click', function (e) {
let id = $(e.target).attr('id');