mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Refs #32819 -- Established relationship between form fieldsets and their help text.
This adds aria-describedby for widgets rendered in a fieldset such as radios. aria-describedby for these widgets is added to the <fieldset> element rather than each <input>.
This commit is contained in:
parent
557fa51837
commit
eec7e9ba89
5 changed files with 91 additions and 8 deletions
|
@ -283,9 +283,10 @@ fields. We've specified ``auto_id=False`` to simplify the output:
|
|||
<div>Sender:<div class="helptext">A valid email address, please.</div><input type="email" name="sender" required></div>
|
||||
<div>Cc myself:<input type="checkbox" name="cc_myself"></div>
|
||||
|
||||
When a field has help text and the widget is not rendered in a ``<fieldset>``,
|
||||
``aria-describedby`` is added to the ``<input>`` to associate it to the
|
||||
help text:
|
||||
When a field has help text it is associated with its input using the
|
||||
``aria-describedby`` HTML attribute. If the widget is rendered in a
|
||||
``<fieldset>`` then ``aria-describedby`` is added to this element, otherwise it
|
||||
is added to the widget's ``<input>``:
|
||||
|
||||
.. code-block:: pycon
|
||||
|
||||
|
@ -325,6 +326,10 @@ inside ``aria-describedby``:
|
|||
|
||||
``aria-describedby`` was added to associate ``help_text`` with its input.
|
||||
|
||||
.. versionchanged:: 5.1
|
||||
|
||||
``aria-describedby`` support was added for ``<fieldset>``.
|
||||
|
||||
``error_messages``
|
||||
------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue