Changes between Initial Version and Version 1 of Ticket #34705


Ignore:
Timestamp:
Jul 11, 2023, 6:39:31 AM (14 months ago)
Author:
Sage Abdullah
Comment:

Updated the patch in the description for better readability.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #34705 – Description

    initial v1  
    3030Patch:
    3131
    32 {{{
    33 diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
    34 index deba739329..b9f29e3da5 100644
     32{{{diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
     33index deba739329..e4261d5e50 100644
    3534--- a/django/forms/boundfield.py
    3635+++ b/django/forms/boundfield.py
    37 @@ -290,7 +290,9 @@ class BoundField(RenderableFieldMixin):
     36@@ -290,10 +290,11 @@ class BoundField(RenderableFieldMixin):
    3837         # If a custom aria-describedby attribute is given and help_text is
    3938         # used, the custom aria-described by is preserved so user can set the
    4039         # desired order.
    4140-        if custom_aria_described_by_id := widget.attrs.get("aria-describedby"):
    42 +        if custom_aria_described_by_id := attrs.get(
    43 +            "aria-describedby"
    44 +        ) or widget.attrs.get("aria-describedby"):
    45              attrs["aria-describedby"] = custom_aria_described_by_id
    46          elif self.field.help_text and self.id_for_label:
    47              attrs["aria-describedby"] = f"{self.id_for_label}_helptext"
     41-            attrs["aria-describedby"] = custom_aria_described_by_id
     42-        elif self.field.help_text and self.id_for_label:
     43-            attrs["aria-describedby"] = f"{self.id_for_label}_helptext"
     44+        if not attrs.get("aria-describedby"):
     45+            if custom_aria_described_by_id := widget.attrs.get("aria-describedby"):
     46+                attrs["aria-describedby"] = custom_aria_described_by_id
     47+            elif self.field.help_text and self.id_for_label:
     48+                attrs["aria-describedby"] = f"{self.id_for_label}_helptext"
     49         return attrs
     50 
     51     @property
    4852}}}
    4953
Back to Top