Skip to content
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

🧹 Add checks for duplicate HTML element IDs #6055

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

rix0rrr
Copy link
Collaborator

@rix0rrr rix0rrr commented Dec 18, 2024

In the course of investigating other issues, I've found that we are emitting invalid HTML. For example, multiple elements with the same id="..." attribute.

This doesn't cause loud errors in the browser, but interferes with the proper functioning HTML selectors and Cypress tests don't always behave like they should.

Add the start of a postprocessing step where we are going to validate the HTML that is generated in Flask templates and crash loudly if it is illegal.

There are many id="..." attributes in our HTML that seem like they're not being used at all by TypeScript code or by HTMX annotations, so I write a little script to identify ones that are definitely unused and removed them. This probably leaves a number of unused id attributes that I couldn't definitely determine as unused, and I don't want to spend time figuring it out for each of them because there are loads.

How to test

This currently breaks the tests because we have illegal templates, but I need to go through this at a later time.

rix0rrr and others added 21 commits December 18, 2024 12:39
In the course of investigating other issues, I've found that we are
emitting invalid HTML. For example, multiple elements with the same
`id="..."` attribute.

This doesn't cause loud errors in the browser, but interferes with the
proper functioning HTML selectors and Cypress tests don't always behave
like they should.

Add the start of a postprocessing step where we are going to validate
the HTML that is generated in Flask templates and crash loudly if it is
illegal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants