From 912ebcb98271227fe8be9879223bc575bf586e58 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Sep 2025 13:37:28 +0000 Subject: [PATCH 1/2] Initial plan From a7a5f85c07f5734f0052cb2e33b699976ca41d26 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Sep 2025 13:47:20 +0000 Subject: [PATCH 2/2] Implement accessibility improvements for screen readers on Ask a Question page Co-authored-by: LiNk-NY <4392950+LiNk-NY@users.noreply.github.com> --- biostar/forum/forms.py | 7 ++- biostar/forum/templates/new_post.html | 4 +- biostar/forum/templatetags/forum_tags.py | 8 ++- themes/bioconductor/static/theme.css | 63 +++++++++++++++++++ .../templates/forms/field_tags.html | 50 ++++++++++++++- 5 files changed, 125 insertions(+), 7 deletions(-) diff --git a/biostar/forum/forms.py b/biostar/forum/forms.py index a88491040..33614e570 100644 --- a/biostar/forum/forms.py +++ b/biostar/forum/forms.py @@ -168,7 +168,12 @@ class PostLongForm(forms.Form): choices = informative_choices(choices=choices) post_type = forms.IntegerField(label="Post Type", - widget=forms.Select(choices=choices, attrs={'class': "ui dropdown"}), + widget=forms.Select(choices=choices, attrs={ + 'class': "ui dropdown", + 'aria-label': "Select post type", + 'aria-required': "true", + 'aria-describedby': "post_type_help" + }), help_text="Select a post type.") title = forms.CharField(label="Post Title", max_length=200, min_length=2, validators=[valid_title, validate_ascii], diff --git a/biostar/forum/templates/new_post.html b/biostar/forum/templates/new_post.html index b3a411b77..abf8c0f3b 100644 --- a/biostar/forum/templates/new_post.html +++ b/biostar/forum/templates/new_post.html @@ -41,7 +41,7 @@
{{ form.post_type.help_text }} Click here for +
{{ form.post_type.help_text }} Click here for more
{% include 'forms/help_text.html' %}{{ form.tag_val.help_text }}
+{{ form.tag_val.help_text }}
diff --git a/biostar/forum/templatetags/forum_tags.py b/biostar/forum/templatetags/forum_tags.py index 899cc0e75..e9a6069c4 100644 --- a/biostar/forum/templatetags/forum_tags.py +++ b/biostar/forum/templatetags/forum_tags.py @@ -320,8 +320,12 @@ def inplace_type_field(post=None, field_id='type'): (opt[0] in Post.TOP_LEVEL), choices) post_type = forms.IntegerField(label="Post Type", - widget=forms.Select(choices=choices, attrs={'class': "ui fluid dropdown", - 'id': field_id}), + widget=forms.Select(choices=choices, attrs={ + 'class': "ui fluid dropdown", + 'id': field_id, + 'aria-label': "Select post type", + 'aria-required': "true" + }), help_text="Select a post type.") value = post.type if post else Post.QUESTION diff --git a/themes/bioconductor/static/theme.css b/themes/bioconductor/static/theme.css index 57b662019..55c97cab5 100644 --- a/themes/bioconductor/static/theme.css +++ b/themes/bioconductor/static/theme.css @@ -118,3 +118,66 @@ body { background-color: #87B13F !important; color: white; } + +/* ======================================== + Accessibility improvements for dropdowns + ======================================== */ + +/* Ensure native select elements are accessible when JavaScript is disabled */ +.ui.dropdown select { + opacity: 1 !important; + position: static !important; + height: auto !important; + width: 100% !important; + visibility: visible !important; +} + +/* Style native selects to look consistent */ +.ui.dropdown.disabled select, +noscript .ui.dropdown select { + display: block !important; + opacity: 1 !important; + position: static !important; + height: auto !important; + width: 100% !important; + visibility: visible !important; + background: white; + border: 1px solid rgba(34,36,38,.15); + border-radius: .28571429rem; + padding: .67857143em 1em; + font-size: 1em; + line-height: 1.21428571em; +} + +/* Hide the custom dropdown UI when JavaScript is disabled */ +noscript .ui.dropdown .text, +noscript .ui.dropdown .dropdown.icon { + display: none !important; +} + +/* Ensure focus is visible on all interactive elements */ +.ui.dropdown:focus, +.ui.dropdown select:focus { + outline: 2px solid #0066cc; + outline-offset: 2px; +} + +/* Improve screen reader announcements */ +.sr-only { + position: absolute; + left: -10000px; + width: 1px; + height: 1px; + overflow: hidden; +} + +/* Ensure form validation messages are accessible */ +.field .error.message { + color: #9f3a38; + font-weight: 600; +} + +.field .error.message:before { + content: "Error: "; + font-weight: bold; +} diff --git a/themes/bioconductor/templates/forms/field_tags.html b/themes/bioconductor/templates/forms/field_tags.html index adc7ace90..7f28fd06c 100644 --- a/themes/bioconductor/templates/forms/field_tags.html +++ b/themes/bioconductor/templates/forms/field_tags.html @@ -1,5 +1,8 @@ + + +