Skip to content

Commit

Permalink
Accessibility: Tab through sub filters only if they're showing. https…
Browse files Browse the repository at this point in the history
  • Loading branch information
diamondap committed Mar 18, 2024
1 parent 6101ae5 commit 45b61cb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
10 changes: 10 additions & 0 deletions static/js/modules/filters-grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ export function initFiltersGrid() {
gridFiltersAll.classList.toggle('is-sr-only');
gridFiltersMore.classList.toggle('is-hidden');
gridFiltersLess.classList.toggle('is-hidden');

// For aria keyboard navigation. https://trello.com/c/CEQ5jAe1
var allFiltersAreShowing = gridFiltersMore.classList.contains("is-hidden")
if (allFiltersAreShowing) {
gridFiltersToggle.setAttribute("aria-expanded", "true")
gridFiltersAll.style.display = "block"
} else {
gridFiltersToggle.setAttribute("aria-expanded", "false")
gridFiltersAll.style.display = "none"
}
});
}
}
4 changes: 2 additions & 2 deletions views/events/_filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h3 class="filters-grid-label text-label text-xs">Filter</h3>
<div class="column is-align-self-flex-end">
<div class="filters-grid-controls">
<input class="filter-button button is-primary" type="submit" value="Filter">
<a class="filter-toggle button is-compact is-white is-not-underlined" href="#gridFiltersAll">
<a class="filter-toggle button is-compact is-white is-not-underlined" aria-expanded="false" aria-controls="gridFiltersAll" href="#gridFiltersAll">
<span class="material-icons md-16" aria-hidden="true">expand_more</span>
<span class="more-filters">More Filters</span>
<span class="less-filters is-hidden">Fewer Filters</span>
Expand All @@ -31,7 +31,7 @@ <h3 class="filters-grid-label text-label text-xs">Filter</h3>
</div>
</div>

<div class="filters-grid-all is-sr-only" id="gridFiltersAll">
<div class="filters-grid-all is-sr-only" id="gridFiltersAll" style="display:none">
<hr>

<div class="columns">
Expand Down
4 changes: 2 additions & 2 deletions views/files/_filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h3 class="filters-grid-label text-label text-xs">Filter</h3>
<div class="column is-align-self-flex-end">
<div class="filters-grid-controls">
<input class="filter-button button is-primary" type="submit" value="Filter">
<a class="filter-toggle button is-compact is-white is-not-underlined" href="#gridFiltersAll">
<a class="filter-toggle button is-compact is-white is-not-underlined" aria-expanded="false" aria-controls="gridFiltersAll" href="#gridFiltersAll">
<span class="material-icons md-16" aria-hidden="true">expand_more</span>
<span class="more-filters">More Filters</span>
<span class="less-filters is-hidden">Fewer Filters</span>
Expand All @@ -30,7 +30,7 @@ <h3 class="filters-grid-label text-label text-xs">Filter</h3>
</div>
</div>

<div class="filters-grid-all is-sr-only" id="gridFiltersAll">
<div class="filters-grid-all is-sr-only" id="gridFiltersAll" style="display:none">
<hr>

<div class="columns">
Expand Down
4 changes: 2 additions & 2 deletions views/objects/_filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h3 class="filters-grid-label text-label text-xs">Filter</h3>
<div class="column is-align-self-flex-end">
<div class="filters-grid-controls">
<input class="filter-button button is-primary" type="submit" value="Filter">
<a class="filter-toggle button is-compact is-white is-not-underlined" href="#gridFiltersAll">
<a class="filter-toggle button is-compact is-white is-not-underlined" aria-expanded="false" aria-controls="gridFiltersAll" href="#gridFiltersAll">
<span class="material-icons md-16" aria-hidden="true">expand_more</span>
<span class="more-filters">More Filters</span>
<span class="less-filters is-hidden">Fewer Filters</span>
Expand All @@ -31,7 +31,7 @@ <h3 class="filters-grid-label text-label text-xs">Filter</h3>
</div>
</div>

<div class="filters-grid-all is-sr-only" id="gridFiltersAll">
<div class="filters-grid-all is-sr-only" id="gridFiltersAll" style="display:none">
<hr>

<div class="columns">
Expand Down
4 changes: 2 additions & 2 deletions views/work_items/_filters.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h3 class="filters-grid-label text-label text-xs">Filter</h3>
<div class="column is-align-self-flex-end">
<div class="filters-grid-controls">
<input class="filter-button button is-primary" type="submit" value="Filter">
<a class="filter-toggle button is-compact is-white is-not-underlined" href="#gridFiltersAll">
<a class="filter-toggle button is-compact is-white is-not-underlined" aria-expanded="false" aria-controls="gridFiltersAll" href="#gridFiltersAll">
<span class="material-icons md-16" aria-hidden="true">expand_more</span>
<span class="more-filters">More Filters</span>
<span class="less-filters is-hidden">Fewer Filters</span>
Expand All @@ -30,7 +30,7 @@ <h3 class="filters-grid-label text-label text-xs">Filter</h3>
</div>
</div>

<div class="filters-grid-all is-sr-only" id="gridFiltersAll">
<div class="filters-grid-all is-sr-only" id="gridFiltersAll" style="display:none">
<hr>

<div class="columns">
Expand Down

0 comments on commit 45b61cb

Please sign in to comment.