diff --git a/views/shared/_filter_chips.html b/views/shared/_filter_chips.html index b0858b7..2cf2abd 100644 --- a/views/shared/_filter_chips.html +++ b/views/shared/_filter_chips.html @@ -2,7 +2,7 @@
{{ range $index, $chip := .filterChips }} - @@ -69,5 +69,15 @@ let newUrl = url + '?' + newParams.toString() window.location = newUrl } + +// Accessibility: Let user remove filters with keyboard navigation. +document.querySelectorAll('[data-filter-index]').forEach((el) => { + el.addEventListener("keydown", function(event){ + if(event.keyCode == 13) { + let filterIndex = el.getAttribute("data-filter-index") + removeFilter(filterIndex) + } + }) +}) {{ end }} \ No newline at end of file