Opened 18 months ago

Last modified 38 hours ago

#34619 closed Bug

Ensure FilteredSelectMultiple select elements are associated with their label — at Version 4

Reported by: Cheuk Ting Ho Owned by: nobody
Component: contrib.admin Version: 4.2
Severity: Normal Keywords: accessibility
Cc: Calvin Vu Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Thibaud Colas)

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:

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:

And where their labels need to be created:

Change History (4)

comment:1 by Cheuk Ting Ho, 18 months ago

Description: modified (diff)

comment:2 by Mariusz Felisiak, 18 months ago

Description: modified (diff)
Triage Stage: UnreviewedAccepted

in admin/auth/group/add/ is lacking the accessible name for the selected. We suspect is the JS widget modified the label generated.

Are we talking about aria-label? Sorry, I'm not an expert in this area.

Tentatively accepted as I believe you discussed this with Thibaud.

comment:3 by Thibaud Colas, 18 months ago

Summary: Ensures select element has an accessible nameEnsure FilteredSelectMultiple select elements are associated with their label

Edited the title a bit – we did discuss this. Though aria-label would be an option, there are visible labels for both select elements where this issue appears, so the best thing to do here would be for those labels to use <label> elements with the appropriate for attribute set to the id of the <select>.

Currently those label elements use h2. We could either add a label within the h2, or replace h2 with label only.

comment:4 by Thibaud Colas, 18 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top