erblint-github icon indicating copy to clipboard operation
erblint-github copied to clipboard

Add lint rule to make sure `<details>` elements have a `<summary>` element

Open koddsson opened this issue 3 years ago • 4 comments

Hey 👋🏻

Here's a rule that makes sure that <details> elements have a <summary> element as well. While a <details> element doesn't need to have a <summary> element, it's good practice to provide one and not let the user agent inject one. Details elements should have a descriptive <summary> element instead.

I haven't written a rule that checks the child elements of a element before so I'm happy to make revisions if I'm doing the child querying incorrectly.

koddsson avatar Mar 14 '22 19:03 koddsson

@koddsson thank you for this 💪

Would you mind adding a corresponding rule doc in docs/rules/accessibility and linking to it in the README? (side note: we should introduce a workflow action to check this)

khiga8 avatar Mar 14 '22 20:03 khiga8

[...] we should introduce a workflow action to check this

We have a meta test in https://github.com/github/eslint-plugin-custom-elements/blob/main/test/check-rules.js that makes sure that each rule is documented in a specific way and that the documentation is linked from the README if you're looking for inspiration.

koddsson avatar Mar 15 '22 12:03 koddsson

Running this on github/github, I'm getting false positives for <details> elements that have content_tag or ViewComponents with tag: :summary.

I feel like I gotta fix those before merging.

koddsson avatar Mar 18 '22 14:03 koddsson

Removing my assignment.

cc @github/accessibility-reviewers (this project’s CODEOWNER)

smockle avatar Jul 25 '24 20:07 smockle