﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
34619	Ensure FilteredSelectMultiple select elements are associated with their label	Cheuk Ting Ho	Calvin Vu	"In the admin UI, the `FilteredSelectMultiple` is missing labels for some of its elements. Here’s a recording of the widget’s UI, and what users would get for it in VoiceOver: 

[[Image(https://code.djangoproject.com/raw-attachment/ticket/34625/permissions-multiple.gif)]]

There are two problems here:

- ""Filter edit text"" – it’s not ideal for both of those to have the same label. Ideally each side would have a separate label (""Filter Available permissions"", ""Filter Chosen permissions""). This could be achieved with adding an `aria-describedby` on the filter `input` elements, pointing to the ""Available permissions"" text (and same for chosen permissions).
- ""list box"" – those `select` elements don’t have a label at all. This needs to be added by transforming the `h2` elements into `label`, with a `for` pointing at each field.

HTML markup:

{{{
<select name=""permissions_old"" id=""id_permissions_from"" multiple="""" class=""filtered"" data-field-name=""permissions"" data-is-stacked=""0"">
}}}

---

This is in `admin/auth/group/add/`. In Django itself, only `contrib.auth` group and user model forms use the `filter_horizontal` ModelAdmin API which has the issue. Not quite sure whether this widget is meant to be reused by users or not. We suspect is the JS widget modified the label generated. The problematic select elements:

- https://github.com/django/django/blob/main/django/contrib/admin/static/admin/js/SelectFilter2.js#L16
- https://github.com/django/django/blob/main/django/contrib/admin/static/admin/js/SelectFilter2.js#L113

And where their labels need to be created:

- https://github.com/django/django/blob/main/django/contrib/admin/static/admin/js/SelectFilter2.js#L38
- https://github.com/django/django/blob/main/django/contrib/admin/static/admin/js/SelectFilter2.js#L83"	Bug	closed	contrib.admin	4.2	Normal	fixed	accessibility	Calvin Vu	Ready for checkin	1	0	0	0	0	0
