Skip to content

Editorial review: Document customizable <select> elements #38470

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

Merged
merged 27 commits into from
Mar 28, 2025

Conversation

chrisdavidmills
Copy link
Contributor

@chrisdavidmills chrisdavidmills commented Mar 5, 2025

Description

Chrome 134 supports customizable <select> elements (see https://chromestatus.com/feature/5737365999976448).

This includes a multitude of sub-features, which are as follows:

  • The <selectedcontent> element mirrors the currently-selected <option> contents. This is the content visible inside the closed <select> element, otherwise known as the select <button>.
  • The ::picker(select) pseudo-element, which targets the entire contents of the select drop-down menu, otherwise known as the picker.
  • The appearance property value base-select, which opts the <select> element and the ::picker(select) pseudo-element into the browser-defined default styles and behavior for customizable select.
  • The :open pseudo-class, which can now target the select <button> when the picker (::picker(select)) is open.
  • The ::picker-icon pseudo-element, which targets the picker icon inside the select <button> — the little down-facing arrow on the inline-end side.
  • The :checked pseudo-class, which can now target the currently-selected <option> element.
  • The ::checkmark pseudo-element, which targets the checkmark placed inside the currently-selected <option> element to provide a visual indication of which one is selected.

In addition, the select <button> and the picker have the following behavior assigned to them automatically:

  • They have an invoker/popover relationship, as specified by the Popover API.
  • They have an implicit anchor reference, meaning that the picker is automatically positioned relative to the select <button> via CSS anchor positioning.

This PR aims to document all of the above new/updated features, and:

  • provide a guide to creating customizable <select>s.

Motivation

Additional details

Related issues and pull requests

Fixes #37857

BCD: mdn/browser-compat-data#26171

@chrisdavidmills chrisdavidmills requested a review from a team as a code owner March 5, 2025 18:09
@chrisdavidmills chrisdavidmills requested review from hamishwillee and removed request for a team March 5, 2025 18:09
@chrisdavidmills chrisdavidmills marked this pull request as draft March 5, 2025 18:09
@github-actions github-actions bot added Content:Learn Learning area docs size/m [PR only] 51-500 LoC changed labels Mar 5, 2025
Copy link
Contributor

github-actions bot commented Mar 5, 2025

Preview URLs (30 pages)
Flaws (40)

Note! 16 documents with no flaws that don't need to be listed. 🎉

URL: /en-US/docs/Learn_web_development/Extensions/Forms/UI_pseudo-classes
Title: UI pseudo-classes
Flaw count: 2

  • broken_links:
    • /en-US/docs/Glossary/void_element is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/void_element which is a redirect

URL: /en-US/docs/Learn_web_development/Extensions/Forms/Other_form_controls
Title: Other form controls
Flaw count: 2

  • broken_links:
    • /en-US/docs/Glossary/void_element is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/void_element which is a redirect

URL: /en-US/docs/Learn_web_development/Extensions/Forms/Sending_and_retrieving_form_data
Title: Sending form data
Flaw count: 2

  • broken_links:
    • /en-US/docs/Glossary/submit_button is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/submit_button which is a redirect

URL: /en-US/docs/Learn_web_development/Extensions/Forms/Basic_native_form_controls
Title: Basic native form controls
Flaw count: 2

  • broken_links:
    • /en-US/docs/Glossary/void_element is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/void_element which is a redirect

URL: /en-US/docs/Learn_web_development/Extensions/Forms/HTML5_input_types
Title: The HTML5 input types
Flaw count: 2

  • broken_links:
    • /en-US/docs/Web/API/validityState/typeMismatch is ill cased
  • macros:
    • Macro produces link /en-US/docs/Web/API/validityState/typeMismatch which is a redirect

URL: /en-US/docs/Learn_web_development/Extensions/Forms/Your_first_form
Title: Your first form
Flaw count: 2

  • broken_links:
    • /en-US/docs/Glossary/void_element is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/void_element which is a redirect

URL: /en-US/docs/Learn_web_development/Extensions/Forms/Sending_forms_through_JavaScript
Title: Sending forms through JavaScript
Flaw count: 2

  • broken_links:
    • /en-US/docs/Glossary/progressive_web_apps is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/progressive_web_apps which is a redirect

URL: /en-US/docs/Learn_web_development/Extensions/Forms/How_to_build_custom_form_controls
Title: How to build custom form controls
Flaw count: 6

  • broken_links:
    • /en-US/docs/Web/API/element/classList is ill cased
    • /en-US/docs/Web/API/element/querySelector is ill cased
    • /en-US/docs/Web/API/element/querySelectorAll is ill cased
  • macros:
    • Macro produces link /en-US/docs/Web/API/element/classList which is a redirect
    • Macro produces link /en-US/docs/Web/API/element/querySelector which is a redirect
    • Macro produces link /en-US/docs/Web/API/element/querySelectorAll which is a redirect

URL: /en-US/docs/Learn_web_development/Extensions/Forms/HTML_forms_in_legacy_browsers
Title: HTML forms in legacy browsers
Flaw count: 1

  • unknown:
    • No generic content config found

URL: /en-US/docs/Learn_web_development/Extensions/Forms/Customizable_select
Title: Customizable select elements
Flaw count: 3

  • broken_links:
    • /en-US/docs/Glossary/top_layer is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/top_layer which is a redirect
    • Can't resolve /en-US/docs/Web/CSS/@starting-state

URL: /en-US/docs/Web/API/Popover_API/Using
Title: Using the Popover API
Flaw count: 8

  • broken_links:
    • /en-US/docs/Glossary/top_layer is ill cased
    • /en-US/docs/Glossary/top_layer is ill cased
    • /en-US/docs/Glossary/inset_properties is ill cased
    • /en-US/docs/Glossary/top_layer is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/top_layer which is a redirect
    • Macro produces link /en-US/docs/Glossary/top_layer which is a redirect
    • Macro produces link /en-US/docs/Glossary/inset_properties which is a redirect
    • Macro produces link /en-US/docs/Glossary/top_layer which is a redirect

URL: /en-US/docs/Web/HTML/Element/button
Title: <button>: The Button element
Flaw count: 4

  • broken_links:
    • /en-US/docs/Glossary/user_agent is ill cased
    • /en-US/docs/Glossary/accessible_name is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/user_agent which is a redirect
    • Macro produces link /en-US/docs/Glossary/accessible_name which is a redirect

URL: /en-US/docs/Web/HTML/Element/select
Title: <select>: The HTML Select element
Flaw count: 2

  • broken_links:
    • /en-US/docs/Glossary/user_agent is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/user_agent which is a redirect

URL: /en-US/docs/Web/CSS/CSS_anchor_positioning/Using
Title: Using CSS anchor positioning
Flaw count: 2

  • broken_links:
    • /en-US/docs/Glossary/inset_properties is ill cased
  • macros:
    • Macro produces link /en-US/docs/Glossary/inset_properties which is a redirect
External URLs (85)

URL: /en-US/docs/Learn_web_development/Extensions/Forms/UI_pseudo-classes
Title: UI pseudo-classes


URL: /en-US/docs/Learn_web_development/Extensions/Forms/Other_form_controls
Title: Other form controls


URL: /en-US/docs/Learn_web_development/Extensions/Forms/Sending_and_retrieving_form_data
Title: Sending form data


URL: /en-US/docs/Learn_web_development/Extensions/Forms/Basic_native_form_controls
Title: Basic native form controls


URL: /en-US/docs/Learn_web_development/Extensions/Forms/HTML5_input_types
Title: The HTML5 input types


URL: /en-US/docs/Learn_web_development/Extensions/Forms/Your_first_form
Title: Your first form


URL: /en-US/docs/Learn_web_development/Extensions/Forms/Form_validation
Title: Client-side form validation


URL: /en-US/docs/Learn_web_development/Extensions/Forms/How_to_build_custom_form_controls
Title: How to build custom form controls


URL: /en-US/docs/Learn_web_development/Extensions/Forms/How_to_structure_a_web_form
Title: How to structure a web form


URL: /en-US/docs/Learn_web_development/Extensions/Forms/HTML_forms_in_legacy_browsers
Title: HTML forms in legacy browsers


URL: /en-US/docs/Web/API/HTMLSelectedContentElement
Title: HTMLSelectedContentElement


URL: /en-US/docs/Web/HTML/Element/selectedcontent
Title: <selectedcontent>: The selected option display element

(comment last updated: 2025-03-10 17:16:57)

@github-actions github-actions bot added Content:HTML Hypertext Markup Language docs size/l [PR only] 501-1000 LoC changed and removed size/m [PR only] 51-500 LoC changed labels Mar 7, 2025
@github-actions github-actions bot added the Content:WebAPI Web API docs label Mar 7, 2025
@github-actions github-actions bot added the Content:CSS Cascading Style Sheets docs label Mar 10, 2025
@chrisdavidmills chrisdavidmills marked this pull request as ready for review March 10, 2025 13:18
@chrisdavidmills chrisdavidmills requested review from a team as code owners March 10, 2025 13:18
@chrisdavidmills chrisdavidmills requested review from dipikabh and removed request for a team March 10, 2025 13:18
Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

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

@chrisdavidmills I have gone through this, but was exhausted by the end, so might have got sloppy. There's a lot here - looks good.

One thing that I don't think was covered is the stuff in the explainer around default aria stuff. Might not be needed, but worth a quick re-read to see if there is something to be said.

aarongable pushed a commit to chromium/chromium that referenced this pull request Mar 25, 2025
The ::checkmark pseudo-element has its contents populated via the
content property. The value of the content property can have an
additional argument provided to set the accessible name, which we
currently set to an empty string by default to hide it from the a11y
tree.

The value isn't important because I think the checked state of the
option element is already provided in a different way, and announcing a
checkmark icon is not helpful.

Based on this discussion, we should do this by default for the
::checkmark pseudo without requiring the author to also set the
accessible name to the empty string:
mdn/content#38470 (comment)

Fixed: 405946933
Change-Id: I983b1e7dff879f2c1a2184c505046d0581f93380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6388535
Reviewed-by: Aaron Leventhal <[email protected]>
Commit-Queue: Aaron Leventhal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1437677}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 25, 2025
The ::checkmark pseudo-element has its contents populated via the
content property. The value of the content property can have an
additional argument provided to set the accessible name, which we
currently set to an empty string by default to hide it from the a11y
tree.

The value isn't important because I think the checked state of the
option element is already provided in a different way, and announcing a
checkmark icon is not helpful.

Based on this discussion, we should do this by default for the
::checkmark pseudo without requiring the author to also set the
accessible name to the empty string:
mdn/content#38470 (comment)

Fixed: 405946933
Change-Id: I983b1e7dff879f2c1a2184c505046d0581f93380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6388535
Reviewed-by: Aaron Leventhal <[email protected]>
Commit-Queue: Aaron Leventhal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1437677}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 25, 2025
The ::checkmark pseudo-element has its contents populated via the
content property. The value of the content property can have an
additional argument provided to set the accessible name, which we
currently set to an empty string by default to hide it from the a11y
tree.

The value isn't important because I think the checked state of the
option element is already provided in a different way, and announcing a
checkmark icon is not helpful.

Based on this discussion, we should do this by default for the
::checkmark pseudo without requiring the author to also set the
accessible name to the empty string:
mdn/content#38470 (comment)

Fixed: 405946933
Change-Id: I983b1e7dff879f2c1a2184c505046d0581f93380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6388535
Reviewed-by: Aaron Leventhal <[email protected]>
Commit-Queue: Aaron Leventhal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1437677}
mohamedamir pushed a commit to mohamedamir/wpt that referenced this pull request Mar 27, 2025
The ::checkmark pseudo-element has its contents populated via the
content property. The value of the content property can have an
additional argument provided to set the accessible name, which we
currently set to an empty string by default to hide it from the a11y
tree.

The value isn't important because I think the checked state of the
option element is already provided in a different way, and announcing a
checkmark icon is not helpful.

Based on this discussion, we should do this by default for the
::checkmark pseudo without requiring the author to also set the
accessible name to the empty string:
mdn/content#38470 (comment)

Fixed: 405946933
Change-Id: I983b1e7dff879f2c1a2184c505046d0581f93380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6388535
Reviewed-by: Aaron Leventhal <[email protected]>
Commit-Queue: Aaron Leventhal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1437677}
Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

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

@chrisdavidmills Thanks for this. I've reviewed your fixes and I think they are good. Added a few more comments but I don't want to block you merging this when you have looked at them so approving.

Note, I didn't look in detail at everything again. There is a lot here and many eyes have been over it.

@hamishwillee hamishwillee dismissed scottaohara’s stale review March 28, 2025 00:36

I believe all those issues have been addressed.

@chrisdavidmills chrisdavidmills requested a review from a team as a code owner March 28, 2025 13:41
@chrisdavidmills
Copy link
Contributor Author

@chrisdavidmills Thanks for this. I've reviewed your fixes and I think they are good. Added a few more comments but I don't want to block you merging this when you have looked at them so approving.

Nice one @hamishwillee — thanks for the excellent review!

@chrisdavidmills chrisdavidmills merged commit 2595b22 into mdn:main Mar 28, 2025
8 checks passed
@chrisdavidmills chrisdavidmills deleted the customizable-select branch March 28, 2025 13:43
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 28, 2025
…, a=testonly

Automatic update from web-platform-tests
Don't make a11y mappings for ::checkmark

The ::checkmark pseudo-element has its contents populated via the
content property. The value of the content property can have an
additional argument provided to set the accessible name, which we
currently set to an empty string by default to hide it from the a11y
tree.

The value isn't important because I think the checked state of the
option element is already provided in a different way, and announcing a
checkmark icon is not helpful.

Based on this discussion, we should do this by default for the
::checkmark pseudo without requiring the author to also set the
accessible name to the empty string:
mdn/content#38470 (comment)

Fixed: 405946933
Change-Id: I983b1e7dff879f2c1a2184c505046d0581f93380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6388535
Reviewed-by: Aaron Leventhal <[email protected]>
Commit-Queue: Aaron Leventhal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1437677}

--

wpt-commits: 02363c922be2f833803a8bd2150a7b18c57192d2
wpt-pr: 51585
@hamishwillee
Copy link
Collaborator

Yay!

glandium pushed a commit to mozilla-firefox/firefox that referenced this pull request Apr 1, 2025
…, a=testonly

Automatic update from web-platform-tests
Don't make a11y mappings for ::checkmark

The ::checkmark pseudo-element has its contents populated via the
content property. The value of the content property can have an
additional argument provided to set the accessible name, which we
currently set to an empty string by default to hide it from the a11y
tree.

The value isn't important because I think the checked state of the
option element is already provided in a different way, and announcing a
checkmark icon is not helpful.

Based on this discussion, we should do this by default for the
::checkmark pseudo without requiring the author to also set the
accessible name to the empty string:
mdn/content#38470 (comment)

Fixed: 405946933
Change-Id: I983b1e7dff879f2c1a2184c505046d0581f93380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6388535
Reviewed-by: Aaron Leventhal <[email protected]>
Commit-Queue: Aaron Leventhal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1437677}

--

wpt-commits: 02363c922be2f833803a8bd2150a7b18c57192d2
wpt-pr: 51585
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Apr 1, 2025
…, a=testonly

Automatic update from web-platform-tests
Don't make a11y mappings for ::checkmark

The ::checkmark pseudo-element has its contents populated via the
content property. The value of the content property can have an
additional argument provided to set the accessible name, which we
currently set to an empty string by default to hide it from the a11y
tree.

The value isn't important because I think the checked state of the
option element is already provided in a different way, and announcing a
checkmark icon is not helpful.

Based on this discussion, we should do this by default for the
::checkmark pseudo without requiring the author to also set the
accessible name to the empty string:
mdn/content#38470 (comment)

Fixed: 405946933
Change-Id: I983b1e7dff879f2c1a2184c505046d0581f93380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6388535
Reviewed-by: Aaron Leventhal <[email protected]>
Commit-Queue: Aaron Leventhal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1437677}

--

wpt-commits: 02363c922be2f833803a8bd2150a7b18c57192d2
wpt-pr: 51585
bramus pushed a commit to bramus/mdn-content that referenced this pull request Apr 1, 2025
* Document customizable <select> elements

* fix typo

* Finish guide

* correct info about how <selectedcontent> is populated

* add links to customizable select guide, update existing pages, remove unneeded links

* Document selectedcontent element

* Add doc for ::picker()

* Document appearance: base-select, tweak :open and :checked ref pages

* Document the ::picker-icon and ::checkmark pseudos

* Add notes on implicit popover-invoker relationship and anchor reference

* Add default picker styling info, tweak other info

* Fixes for josepharhar review comments

* Fixes for josepharhar review comments

* Fixes for scottaohara review comments

* Accessibility and <select> content fixes

* Additional fixes

* Additional fixes

* Additional fixes

* Fixes for hamishwillee review comments

* Change other elements back to other content

* Last few tweaks from hamishwillee review
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Apr 9, 2025
…, a=testonly

Automatic update from web-platform-tests
Don't make a11y mappings for ::checkmark

The ::checkmark pseudo-element has its contents populated via the
content property. The value of the content property can have an
additional argument provided to set the accessible name, which we
currently set to an empty string by default to hide it from the a11y
tree.

The value isn't important because I think the checked state of the
option element is already provided in a different way, and announcing a
checkmark icon is not helpful.

Based on this discussion, we should do this by default for the
::checkmark pseudo without requiring the author to also set the
accessible name to the empty string:
mdn/content#38470 (comment)

Fixed: 405946933
Change-Id: I983b1e7dff879f2c1a2184c505046d0581f93380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6388535
Reviewed-by: Aaron Leventhal <[email protected]>
Commit-Queue: Aaron Leventhal <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1437677}

--

wpt-commits: 02363c922be2f833803a8bd2150a7b18c57192d2
wpt-pr: 51585
cssinate pushed a commit to cssinate/content that referenced this pull request Apr 11, 2025
* Document customizable <select> elements

* fix typo

* Finish guide

* correct info about how <selectedcontent> is populated

* add links to customizable select guide, update existing pages, remove unneeded links

* Document selectedcontent element

* Add doc for ::picker()

* Document appearance: base-select, tweak :open and :checked ref pages

* Document the ::picker-icon and ::checkmark pseudos

* Add notes on implicit popover-invoker relationship and anchor reference

* Add default picker styling info, tweak other info

* Fixes for josepharhar review comments

* Fixes for josepharhar review comments

* Fixes for scottaohara review comments

* Accessibility and <select> content fixes

* Additional fixes

* Additional fixes

* Additional fixes

* Fixes for hamishwillee review comments

* Change other elements back to other content

* Last few tweaks from hamishwillee review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:CSS Cascading Style Sheets docs Content:HTML Hypertext Markup Language docs Content:Learn Learning area docs Content:WebAPI Web API docs size/xl [PR only] >1000 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Customizable select element
5 participants