﻿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
36772	`aria-describedby`-Attribute missing from file field HTML in Django 6.0	cessor		"In Django 6, input fields of type `file` do not render `aria-describedby` attributes. Those were introduced with Django 5.2. to facilitate use of screenreaders. 

== Steps to reproduce

 - Create a model with a `file = models.FileField(...)`
 - Render a `forms.ModelForm` for the model
 - The HTML for the input field should contain attribute `aria-describedby=""id_file_helptext""`
 - When Django 5.2 is installed the attribute is rendered
 - When Django 6.0 is installed, the attribute is not rendered
 
Note that this issue affects `FileFields` but not `CharFields`. Both render HTML input elements. I did not test whether other fields are also affected.

I attached a zipfile with an example app. To reproduce the error, please create a .venv and install Django 5.2, then run `manage.py tests`; all will succeed. When installing Django 6, one test will fail. The module `web.tests` contains two tests, both check the input field HTML for `aria-describedby`, one is for a charfield, the other for a filefield. 


== Details

Consider Issue #35892 ""Supported Widget.use_fieldset in admin forms."". In the scope of this ticked, a change was made to `django.forms.widgets.ClearableFileInput`, where as with commit 4187da2 the value `ClearableFileInput.use_fieldset` is set to `True` by default. 

Because of this change, `django.forms.boundfield.BoundField.build_widget_attrs` does not add the ""aria-describedby"" attribute to the `attrs` dictionary which is then missing from the final response HTML.

Sources: 
 - https://github.com/django/django/blame/0ca3a0661173b02e2cbb0183d8543e790e7e4a55/django/forms/widgets.py#L533
 - https://github.com/django/django/blob/0ca3a0661173b02e2cbb0183d8543e790e7e4a55/django/forms/boundfield.py#L300"	Bug	closed	Forms	6.0	Normal	invalid	forms, aria, fieldset, accessibility, admin	cessor	Unreviewed	0	0	0	0	0	0
