Opened 18 months ago
Closed 18 months ago
#34622 closed Bug (fixed)
RelatedFieldWidgetWrapper links don’t convey their state for screen reader users
Reported by: | Thibaud Colas | Owned by: | Coen van der Kamp |
---|---|---|---|
Component: | contrib.admin | Version: | 4.2 |
Severity: | Normal | Keywords: | accessibility, screen reader |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | yes |
Description
Fields using RelatedFieldWidgetWrapper
have three links/buttons next to them to go to the Change/Add/View views for their model. Those links use a bit of JS to toggle whether the link is active or not based on whether the field has a value.
This link state (disabled/enabled) isn’t communicated to screen reader users in any way. We should be able to solve this by adding a aria-disabled="true"
attribute on those links when they are disabled (making sure to remove the attribute when the links are enabled).
- Template: https://github.com/django/django/blob/main/django/contrib/admin/templates/admin/widgets/related_widget_wrapper.html
- And I believe the "link enabled/disabled" logic happens here: https://github.com/django/django/blob/main/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
_In addition_ this is unrelated but it’d be much nicer for screen reader users if the images within those links had alt=""
. Right now the presence of alt
means screen reader users will hear "link, image, Change" – the fact there’s an image is completely irrelevant here. It’d be much better to instead have link, Change selected <thing>
(coming from the title attribute).
Change History (6)
comment:1 by , 18 months ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 18 months ago
Has patch: | set |
---|
comment:3 by , 18 months ago
Needs tests: | set |
---|
comment:5 by , 18 months ago
Needs tests: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
PR: https://github.com/django/django/pull/16927