-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
Fixed #35892 -- Supported Widget.use_fieldset in admin forms and linked help texts aria-describedby for accessibility. #19678
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,10 @@ | |
message = interpolate(message, [timezoneOffset]); | ||
|
||
const warning = document.createElement('div'); | ||
const id = inp.id; | ||
const field_id = inp.closest('p.datetime') ? id.slice(0, id.lastIndexOf("_")) : id; | ||
warning.classList.add('help', warningClass); | ||
warning.id = `${field_id}_timezone_warning_helptext`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this helptext should also be specific to the input rather than the fieldset There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I think the same. It seems better to associate it with each input element. |
||
warning.textContent = message; | ||
inp.parentNode.appendChild(warning); | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<p class="datetime"> | ||
{{ date_label }} {% with widget=widget.subwidgets.0 %}{% include widget.template_name %}{% endwith %}<br> | ||
{{ time_label }} {% with widget=widget.subwidgets.1 %}{% include widget.template_name %}{% endwith %} | ||
<label {% if widget.attrs.id %}for="{{ widget.subwidgets.0.attrs.id }}"{% endif %}>{{ date_label }}</label> {% with widget=widget.subwidgets.0 %}{% include widget.template_name %}{% endwith %}<br> | ||
<label {% if widget.attrs.id %}for="{{ widget.subwidgets.1.attrs.id }}"{% endif %}>{{ time_label }}</label> {% with widget=widget.subwidgets.1 %}{% include widget.template_name %}{% endwith %} | ||
</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the help text for the from box rather than the help text for the fieldset, so the from box should have the
aria-describedby
attribute (not the fieldset). Similar for the to boxThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pointing out such an important detail.
Currently, when the select element is focused, it’s connected to the title via
aria-labelledby
, so both the label and a description are provided.However, it might be better to provide the label via
aria-labelledby
, and then connect the help text and the instructions for selecting multiple options usingaria-describedby
.