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

the default option of a select #36658

Merged
merged 3 commits into from
Nov 19, 2024
Merged

the default option of a select #36658

merged 3 commits into from
Nov 19, 2024

Conversation

jolka-ef
Copy link
Contributor

@jolka-ef jolka-ef commented Nov 5, 2024

Update information about the selected option.

Fixes #36573

@jolka-ef jolka-ef requested a review from a team as a code owner November 5, 2024 11:43
@jolka-ef jolka-ef requested review from chrisdavidmills and removed request for a team November 5, 2024 11:43
@github-actions github-actions bot added the Content:HTML Hypertext Markup Language docs label Nov 5, 2024
@github-actions github-actions bot added the size/xs [PR only] 0-5 LoC changed label Nov 5, 2024
Copy link
Contributor

github-actions bot commented Nov 5, 2024

Preview URLs

(comment last updated: 2024-11-19 10:06:27)

Copy link
Contributor

github-actions bot commented Nov 5, 2024

Preview URLs

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there @jolka-ef , and thank you for your contribution to MDN! What you added was fine, but I've offered a suggestion that I feel makes it a little clearer, plus I've also suggested an extra sentence that provides another bit of information that was missing. Let me know what you think!

@@ -13,7 +13,7 @@ The **`<select>`** [HTML](/en-US/docs/Web/HTML) element represents a control tha

The above example shows typical `<select>` usage. It is given an `id` attribute to enable it to be associated with a {{htmlelement("label")}} for accessibility purposes, as well as a `name` attribute to represent the name of the associated data point submitted to the server. Each menu option is defined by an {{htmlelement("option")}} element nested inside the `<select>`.

Each `<option>` element should have a [`value`](/en-US/docs/Web/HTML/Element/option#value) attribute containing the data value to submit to the server when that option is selected. If no `value` attribute is included, the value defaults to the text contained inside the element. You can include a [`selected`](/en-US/docs/Web/HTML/Element/option#selected) attribute on an `<option>` element to make it selected by default when the page first loads.
Each `<option>` element should have a [`value`](/en-US/docs/Web/HTML/Element/option#value) attribute containing the data value to submit to the server when that option is selected. If no `value` attribute is included, the value defaults to the text contained inside the element. You can include a [`selected`](/en-US/docs/Web/HTML/Element/option#selected) attribute on an `<option>` element to make it selected by default when the page first loads. The first element will be selected as the default if none is specified.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Each `<option>` element should have a [`value`](/en-US/docs/Web/HTML/Element/option#value) attribute containing the data value to submit to the server when that option is selected. If no `value` attribute is included, the value defaults to the text contained inside the element. You can include a [`selected`](/en-US/docs/Web/HTML/Element/option#selected) attribute on an `<option>` element to make it selected by default when the page first loads. The first element will be selected as the default if none is specified.
Each `<option>` element should have a [`value`](/en-US/docs/Web/HTML/Element/option#value) attribute containing the data value to submit to the server when that option is selected. If no `value` attribute is included, the value defaults to the text contained inside the element. You can include a [`selected`](/en-US/docs/Web/HTML/Element/option#selected) attribute on an `<option>` element to make it selected by default when the page first loads. If no `selected` attribute is specified, the first `<option>` element will be selected by default. If multiple `<option>` elements have `selected` attributes specified, the last one in the source order will be selected by default.

@jolka-ef
Copy link
Contributor Author

jolka-ef commented Nov 5, 2024

@chrisdavidmills Before I begin my actual comment, I would like to apologize in advance for my inadequate level of English proficiency.
I am not a native speaker :)
I think the text is now much better and clearer, although I have some doubts about this part

If multiple <option> elements have selected attributes specified, the last one in the source order will be selected by default.

because if I understand the specification correctly, that's not usage they encourage.
Specs states

A select element whose multiple attribute is not specified must not have more than one descendant option element with its selected attribute set.

@jolka-ef
Copy link
Contributor Author

Hi @chrisdavidmills !
I add only part of changes. Is it okay with you ?

@chrisdavidmills
Copy link
Contributor

Hi @chrisdavidmills ! I add only part of changes. Is it okay with you ?

Hi @jolka-ef! Sorry I missed this earlier. Yes, I think this is fine—the change you've made fixes the actual issue you were tackling. Thanks so much!

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@chrisdavidmills chrisdavidmills merged commit 57bda38 into mdn:main Nov 19, 2024
8 checks passed
wbamberg added a commit to wbamberg/content that referenced this pull request Nov 27, 2024
* origin/xss-guide: (284 commits)
  Add information on default entryPoint property values (mdn#36633)
  Bump husky from 9.1.6 to 9.1.7 (mdn#36863)
  fix(performance): Typo '50ms seconds' (mdn#36861)
  Add spec_url & add note for bcd for `<frequency>` and `<frequency-percentage>` (mdn#36848)
  addresses 36583: summary icon styles (mdn#36691)
  Remove "simple" part 3: change to "basic"  (mdn#36762)
  the default option of a select (mdn#36658)
  docs(css): Add support for `<string>` in `syntax` descriptor of @Property at-rule (mdn#36655)
  Fix parameter syntax for `Navigation.updateCurrentEntry()` (mdn#36852)
  Update CSP source expression reference (mdn#36792)
  chore(http): Refresh headers docs (d-k) (mdn#36075)
  chore(http): Refresh headers r-s (mdn#36590)
  Updated index.md (mdn#36845)
  fix : wrong method name (mdn#36843)
  Remove all redirects to other locales (mdn#36811)
  fix typos (mdn#36837)
  docs: update Accept-Charset status (mdn#36822)
  updateSelection: make more intuitive (mdn#36834)
  updateText: Remove false information (mdn#36832)
  DOMRect instance properties (mdn#36704)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:HTML Hypertext Markup Language docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

What is the default option of a select element when none is selected?
2 participants