﻿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
31158	_password_validators_help_text_html() returns HTML block level element.	Carsten Fuchs	nobody	"In `django.contrib.auth.password_validation`, function `_password_validators_help_text_html()` returns a `<ul>` list, which is an HTML block level element. (If I understood it correctly, this was introduced in #26097.) This list is used as the `help_text` of a related form field.

Imho, from the view of a template author for rendering the form, getting a `<ul>` here is somewhat unexpected:

  - Help texts are usually brief, one line statements that are written inline in Field constructors calls; the Django documentation has numerous examples.
  - The documentation of `help_text` seems to expect such simple texts as well: https://docs.djangoproject.com/en/3.0/ref/forms/fields/#help-text shows the form rendered with `f.as_p()` at the bottom of the example.
  - In many form (template) examples that I can find, including Bootstrap's, `{{ field.help_text }}` is usually wrapped in `<p>` or `<small>` elements.

As having block level elements in `<p>` or `<small>` is invalid HTML, I suggest to join the strings of the password validators with a simple `<br>` instead. For example:
{{{
#!python
def _password_validators_help_text_html(password_validators=None):
    """"""
    Return an HTML string with all help texts of all configured validators,
    separated by <br> tags.
    """"""
    help_texts = password_validators_help_texts(password_validators)
    return mark_safe(""<br>"".join(escape(h) for h in help_texts))
}}}"	Uncategorized	closed	contrib.auth	3.0	Normal	wontfix			Unreviewed	0	0	0	0	0	0
