-
Notifications
You must be signed in to change notification settings - Fork 0
🎨 Palette: Improve accessibility of filter buttons in coverage view #537
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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
|
|
||
| ## 2026-06-29 - [Filter Button Accessibility] | ||
| **Learning:** Maud templates (`html!`) do not easily support dynamic boolean attributes evaluated conditionally at runtime via JavaScript. | ||
| **Action:** For UI components like filter buttons, establish static initial states (e.g., `aria-pressed="true"`) and update them using vanilla JS (e.g., `setAttribute('aria-pressed', 'true')`) to ensure proper accessibility communication to screen readers. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -621,11 +621,11 @@ fn coverage_content() -> Markup { | |||||||||||||||||
| .card { | ||||||||||||||||||
| h2 { "Acceptance Criteria Coverage" } | ||||||||||||||||||
| .filter-controls data-uiid="coverage.filters" { | ||||||||||||||||||
| button #filter-all.filter-btn onclick="filterData('all')" { "All" } | ||||||||||||||||||
| button #filter-passing.filter-btn onclick="filterData('passing')" { "Passing" } | ||||||||||||||||||
| button #filter-failing.filter-btn onclick="filterData('failing')" { "Failing" } | ||||||||||||||||||
| button #filter-unknown.filter-btn onclick="filterData('unknown')" { "Unknown" } | ||||||||||||||||||
| input #search-box.search-box type="text" placeholder="Search by AC ID or title..." | ||||||||||||||||||
| button #filter-all.filter-btn aria-pressed="true" onclick="filterData('all')" { "All" } | ||||||||||||||||||
| button #filter-passing.filter-btn aria-pressed="false" onclick="filterData('passing')" { "Passing" } | ||||||||||||||||||
| button #filter-failing.filter-btn aria-pressed="false" onclick="filterData('failing')" { "Failing" } | ||||||||||||||||||
| button #filter-unknown.filter-btn aria-pressed="false" onclick="filterData('unknown')" { "Unknown" } | ||||||||||||||||||
| input #search-box.search-box type="search" aria-label="Search acceptance criteria" placeholder="Search by AC ID or title..." | ||||||||||||||||||
| oninput="searchData()"; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
@@ -766,8 +766,11 @@ fn coverage_script() -> &'static str { | |||||||||||||||||
| // Update active button | ||||||||||||||||||
| document.querySelectorAll('.filter-btn').forEach(btn => { | ||||||||||||||||||
| btn.classList.remove('active'); | ||||||||||||||||||
| btn.setAttribute('aria-pressed', 'false'); | ||||||||||||||||||
| }); | ||||||||||||||||||
| document.getElementById('filter-' + status).classList.add('active'); | ||||||||||||||||||
| const activeBtn = document.getElementById('filter-' + status); | ||||||||||||||||||
| activeBtn.classList.add('active'); | ||||||||||||||||||
| activeBtn.setAttribute('aria-pressed', 'true'); | ||||||||||||||||||
|
Comment on lines
+771
to
+773
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. If
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| // Apply filter | ||||||||||||||||||
| applyFilters(); | ||||||||||||||||||
|
|
||||||||||||||||||
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.
If
document.getElementByIdreturnsnull(e.g., due to an unexpected status or DOM state), callingclassList.addorsetAttributedirectly onactiveBtnwill throw a runtimeTypeErrorand halt subsequent JavaScript execution. Adding a safety check ensures the script fails gracefully.