﻿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
35755	Help text for hidden fields is visible in admin fieldsets	Richard Laager	Richard Laager	"This is present in 4.2 through git main.

If a field is hidden, its help_text shows.

This regressed in commit 96a598356a9ea8c2c05b22cadc12e256a3b295fd:
https://github.com/django/django/commit/96a598356a9ea8c2c05b22cadc12e256a3b295fd

from PR 16161:
https://github.com/django/django/pull/16161

This happened because the <div class=""help""> is now after, as opposed to inside, the <div> that gets class ""hidden"".

There are two possible fixes:

A) Do not output the help div at all:

{{{
--- a/django/contrib/admin/templates/admin/includes/fieldset.html
+++ b/django/contrib/admin/templates/admin/includes/fieldset.html
@@ -26,7 +26,7 @@
                                 {% endif %}
                             {% endif %}
                         </div>
-                    {% if field.field.help_text %}
+                    {% if field.field.help_text and not field.field.is_hidden %}
                         <div class=""help""{% if field.field.id_for_label %} id=""{{ field.field.id_for_label }}_helptext""{% endif %}>
                             <div>{{ field.field.help_text|safe }}</div>
                         </div>
}}}

B) Set ""hidden"" on the help div:
{{{
--- a/django/contrib/admin/templates/admin/includes/fieldset.html
+++ b/django/contrib/admin/templates/admin/includes/fieldset.html
@@ -27,7 +27,7 @@
                             {% endif %}
                         </div>
                     {% if field.field.help_text %}
-                        <div class=""help""{% if field.field.id_for_label %} id=""{{ field.field.id_for_label }}_helptext""{% endif %}>
+                        <div class=""help{% if field.field.is_hidden %} hidden{% endif %}""{% if field.field.id_for_label %} id=""{{ field.field.id_for_label }}_helptext""{% endif %}>
                             <div>{{ field.field.help_text|safe }}</div>
                         </div>
                     {% endif %}
}}}

Either fix works. I'm just not sure stylistically which one you want."	Bug	closed	contrib.admin	4.2	Normal	fixed		Tom Carrick	Ready for checkin	1	0	0	0	1	1
