Describe the bug
Caching functionality was added to the proposals listing view in #6808 by @armandfardeau. In particular, it added the fragment cache to the filters section of the view:
|
<% cache filter_cache_hash(filter) do %> |
This is problematic because the filter inputs generate HTML IDs and this particular partial is included twice on the page:
First time here:
|
<%= render partial: "filters" %> |
Second time here:
|
<%= render partial: "filters" %> |
Now both of these views will use the same generated HTML causing them both to use the exact same element IDs which are now duplicated in the view.
The duplicate IDs produce invalid HTML which is an accessibility violation (WCAG 2.1 / SC 4.1.1 - Parsing):
(Level A)
In content implemented using markup languages, elements have complete start and end tags, elements are nested according to their specifications, elements do not contain duplicate attributes, and any IDs are unique, except where the specifications allow these features.
https://www.w3.org/TR/WCAG21/#parsing
To Reproduce
Steps to reproduce the behavior:
- Go to https://meta.decidim.org/processes/roadmap/f/122/
- Open the developer console of the browser
- See lots of non-unique ID warnings printed
Expected behavior
I would expect all elements on the page to have unique IDs.
Screenshots

Stacktrace
Run the page through the W3.org HTML validator to see the validation errors:
https://validator.w3.org/nu/?doc=https%3A%2F%2Fmeta.decidim.org%2Fprocesses%2Froadmap%2Ff%2F122%2F
Extra data (please complete the following information):
- Device: (any)
- Device OS: (any)
- Browser: (any)
- Decidim Version: 0.24.0.rc1
- Decidim installation: MetaDecidim
Additional context
The cache has to be probably separately generated for the mobile and desktop filters to generate unique IDs.
Describe the bug
Caching functionality was added to the proposals listing view in #6808 by @armandfardeau. In particular, it added the fragment cache to the filters section of the view:
decidim/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb
Line 3 in d640192
This is problematic because the filter inputs generate HTML IDs and this particular partial is included twice on the page:
First time here:
decidim/decidim-proposals/app/views/decidim/proposals/proposals/_filters_small_view.html.erb
Line 16 in d640192
Second time here:
decidim/decidim-proposals/app/views/decidim/proposals/proposals/index.html.erb
Line 50 in d640192
Now both of these views will use the same generated HTML causing them both to use the exact same element IDs which are now duplicated in the view.
The duplicate IDs produce invalid HTML which is an accessibility violation (WCAG 2.1 / SC 4.1.1 - Parsing):
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I would expect all elements on the page to have unique IDs.
Screenshots

Stacktrace
Run the page through the W3.org HTML validator to see the validation errors:
https://validator.w3.org/nu/?doc=https%3A%2F%2Fmeta.decidim.org%2Fprocesses%2Froadmap%2Ff%2F122%2F
Extra data (please complete the following information):
Additional context
The cache has to be probably separately generated for the mobile and desktop filters to generate unique IDs.