Skip to content

Proposals filters cache causes lots of non-unique element IDs (violates WCAG 2.1 / SC 4.1.1) #7528

@ahukkanen

Description

@ahukkanen

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:

This is problematic because the filter inputs generate HTML IDs and this particular partial is included twice on the page:

First time here:

Second time here:

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:

  1. Go to https://meta.decidim.org/processes/roadmap/f/122/
  2. Open the developer console of the browser
  3. See lots of non-unique ID warnings printed

Expected behavior
I would expect all elements on the page to have unique IDs.

Screenshots
metadecidim-non-unique-ids

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions