Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix help text and error IDs for aria-describedby #746

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xi
Copy link
Contributor

@xi xi commented Mar 3, 2025

Django recently started using aria-describedby to associate form fields first with their help texts, and later also with error messages.

In #716, django-bootstrap5 was adapted to also include those the necessary IDs in templates.

aria-describedby for fields can have different values:

  • "{field.auto_id}_helptext"
  • "{field.auto_id}_error"
  • both of them
  • a user defined value that is left unchanged

The approach in #716 was to use the value from aria-describedby for the ID of the help text. Unfortunately, this only works in the first case.

So I propose to solve this the same way the django templates solve this and just hardcode the IDs.

Django recently started using `aria-describedby` to associate form
fields first with their help texts, and later also with error messages.

In zostera#716, django-bootstrap5 was adapted to also include those the
necessary IDs in templates.

`aria-describedby` for fields can have different values:

-   `"{field.auto_id}_helptext"`
-   `"{field.auto_id}_error"`
-   both of them
-   a user defined value that is left unchanged

The approach in zostera#716 was to use the value from `aria-describedby` for
the ID of the help text. Unfortunately, this only works in the first
case.

So I propose to solve this the same way the django templates solve this
and just hardcode the IDs.
@xi xi force-pushed the fix-error-aria-describedby branch from 53ea6b5 to dba5fc0 Compare March 3, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant