Hi,
I have a question regarding the autocomplete field assigned as a dropdown in Django admin. In earlier versions of Django (3.X), when users clicked on the dropdown box (Foreign Key selector), the text input editor would automatically gain focus. This allowed users to start typing immediately to search through the list of foreign key values without any extra clicks.
For better understanding this is the field I’m talking about:
class YourModelAdmin(admin.ModelAdmin):
autocomplete_fields = ['your_field']
However, after updating to a newer version of Django (4.X), they now have to click in the text input editor after clicking the dropdown field title. The input editor does not automatically gain focus anymore, which adds an extra step to the process.
Can anyone explain why this change occurred and if there is a way to restore the previous behavior where the cursor automatically moves into the input field so users can begin typing right away?
I’m currently working on Django 4.0.1.
I’m aware there could be a possible solution using some custom javascript, but I was wondering if there is an easier way to get this functionality back, or maybe it will be working in future releases of django that way?
This changed of behavior was also noticed here, but I did not find any solution or recommendation:
Any help would be appreciated
@KenWhitesell , any idea on this?
Thank you.