1

I am using <detail> elements with the name set to create a group of accordions, e.g.

<details name="accordion-group" open>
  <summary>Header 1</summary>
  E lorem ipsum...
</details>
<details name="accordion-group">
  <summary>Header 2</summary>
  Foo bar
</details>

This works well, but when I check the HTML against the W3 Nu Html Checker, I get these errors for each <detail> element:

Attribute name not allowed on element details at this point.

However, according to the specs, the <detail> element allows for all global attributes, name, and open. Here is the documentation: https://html.spec.whatwg.org/multipage/interactive-elements.html#the-details-element There is even a blurb in the documentation specific to the name attribute:

The name content attribute gives the name of the group of related details elements that the element is a member of. Opening one member of this group causes other members of the group to close. If the attribute is specified, its value must not be the empty string.

There is even an example of using the name attribute in the specs (example), but doing a rote copy/paste in the validator causes the same error to appear.

Is this just a bug in the Nu Html Checker widget -or- are there certain scenarios in which you cannot use the name attribute on the <details> element?

2
  • The name attribute is new and is not yet in the official HTML5.3 / WHATWG spec that the w3c uses that's why you get these errors Yet it works on modern browsers Chrome (120+), Safari (17.4+), and Edge (120+) Commented Nov 4 at 18:49
  • @ahmadfakher - Where do they list the spec that they're following because the link they reference in the error message points to the spec that supports the name attribute. Commented Nov 4 at 22:43

1 Answer 1

1

Yes, this is valid HTML, and it's just that the validator doesn't support this feature yet.
There is an open issue on the nu-validator project, opened in 2023 when the feature got added to HTML. The issue got activity just 2 days ago, but I'm not sure this means anyone is working on adding support for it yet.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.