Skip to content

incorrect <select> required attribute description #44397

@sb3nder

Description

@sb3nder

MDN URL

https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/select#attributes

What specific section or headline is this issue about?

required attribute

What information was incorrect, unhelpful, or incomplete?

The description says:

A Boolean attribute indicating that an option with a non-empty string value must be selected.

This is wrong, for example this is valid:

<select required>
  <option value="">placeholder</option>
  <option value="" selected>valid empty option</option>
</select>

What did you expect to see?

A Boolean attribute indicating that at least one non-placeholder option must be selected.

Do you have any supporting links, references, or citations?

https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element

Constraint validation: If the element has its required attribute specified, and either none of the option elements in the select element's list of options have their selectedness set to true, or the only option element in the select element's list of options with its selectedness set to true is the placeholder label option, then the element is suffering from being missing.

Do you have anything more you want to share?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Content:HTMLHypertext Markup Language docsneeds triageTriage needed by staff and/or partners. Automatically applied when an issue is opened.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions