#37010: Admin: improve filtered select feedback while filtering
----------------------------+-----------------------------------------
     Reporter:  David Ansa  |                     Type:  New feature
       Status:  new         |                Component:  contrib.admin
      Version:  dev         |                 Severity:  Normal
     Keywords:              |             Triage Stage:  Unreviewed
    Has patch:  0           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  0           |                    UI/UX:  1
----------------------------+-----------------------------------------
 The admin FilteredSelectMultiple / SelectFilter2 widget supports filtering
 large option lists, but its filtered state is hard to understand during
 bulk actions.

 Current behavior

 Filtering narrows the visible options in the "Available" and "Chosen"
 lists.
 The widget does not show how many options remain visible after filtering.
 The bulk buttons keep the labels "Choose all ..." and "Remove all ..."
 even when a filter is active.
 In practice, those bulk actions operate on the displayed subset, which can
 be surprising when the label suggests that all options will be affected.
 Clearing a filter requires manually deleting the filter text.

 Proposed improvement

 Show a live X of Y shown count next to the filter input while a filter is
 active.
 Relabel bulk actions while filtering so they read:
 Choose all displayed ...
 Remove all displayed ...
 Allow the active filter to be cleared with the Escape key.
 Keep the filtered state and labels synchronized after moving options
 between the two lists.

 Why this is useful

 It makes filter_horizontal / filter_vertical easier to understand on large
 many-to-many lists.
 It clarifies what bulk actions will do while the list is filtered.
 It improves keyboard usability without changing the widget API.

 Implementation notes

 This can be implemented in
 django/contrib/admin/static/admin/js/SelectFilter2.js.
 A small style hook is useful in
 django/contrib/admin/static/admin/css/widgets.css.
 Regression coverage fits well in tests/admin_widgets/tests.py with
 Selenium tests around the filtered-select widget behavior.

 Testing

 Add Selenium coverage for:
 live X of Y shown feedback when filtering
 updated bulk-action labels while a filter is active
 clearing filters with Escape
 Relevant test command:
 .\.venv\Scripts\python.exe tests\runtests.py
 admin_widgets.tests.HorizontalVerticalFilterSeleniumTests
 --selenium=chrome --parallel 1

 Notes

 I did a quick Trac search for existing SelectFilter2 /
 FilteredSelectMultiple tickets but did not find an obvious existing match
 for this exact UX improvement.
 This looks small in scope, but it is a user-visible admin behavior change,
 so I am filing it before asking for review on the related PR.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37010>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d385fa0f0-e48bff3f-e5d1-483d-8b27-6302456a0950-000000%40eu-central-1.amazonses.com.

Reply via email to