Skip to content

Change definition of select element list box and drop-down box rendering#11460

Merged
annevk merged 10 commits intowhatwg:mainfrom
josepharhar:listbox
Mar 11, 2026
Merged

Change definition of select element list box and drop-down box rendering#11460
annevk merged 10 commits intowhatwg:mainfrom
josepharhar:listbox

Conversation

@josepharhar
Copy link
Copy Markdown
Contributor

@josepharhar josepharhar commented Jul 16, 2025

This PR allows select elements with the multiple attribute to be rendered as a drop-down box when the author explicitly sets the size attribute to 1.

The related issue should be resolved by requiring that mobile browsers and desktop browsers both follow these rules in order to improve cross-platform compatibility.

Fixes #8189

(See WHATWG Working Mode: Changes for more details.)


/form-elements.html ( diff )
/rendering.html ( diff )

This PR allows select elements with the multiple attribute to be
rendered as a drop-down box when the author explicitly sets the size
attribute to 1.

The related issue should be resolved by requiring that mobile browsers
and desktop browsers both follow these rules in order to improve
cross-platform compatibility.

Fixes whatwg#8189
@josepharhar
Copy link
Copy Markdown
Contributor Author

This PR implements the plan I wrote in this issue: #8189

The UseCounter data I've collected so far looks OK, but this change might not end up being web compatible. Before I try shipping this and finding out, I'd like feedback on this from Apple and Mozilla.

@mtrootyy
Copy link
Copy Markdown

The following changes are also required:

4.10.7 The select element
If a select element has a required attribute specified, does not have a multiple attribute specified, and has a display size of 1; and if the value of the first option element in the select element's list of options (if any) is the empty string, and that option element's parent node is the select element (and not an optgroup element), then that option is the select element's placeholder label option.

If a select element has a required attribute specified, and has a display size of 1; and if the value of the first option element in the select element's list of options (if any) is the empty string, and that option element's parent node is the select element (and not an optgroup element), then that option is the select element's placeholder label option.

Aria in HTML(https://w3c.github.io/html-aria/)
select (with NO multiple attribute and NO size attribute having value greater than 1)

select (with NO size attribute having value greater than 1)

select (with a multiple attribute or a size attribute having value greater than 1)

select (with a size attribute having value greater than 1)

@josepharhar josepharhar changed the title Change definition of list box and drop-down box rendering Change definition of select element list box and drop-down box rendering Jul 23, 2025
josepharhar added a commit to josepharhar/html-aria that referenced this pull request Jul 23, 2025
In this HTML PR I am planning on changing the definition of how combobox
vs listbox rendering is done with size and multiple attributes:
whatwg/html#11460

This PR defers to the HTML definition of display size which defines
combobox vs listbox rendering based on multiple and size attributes.
@josepharhar
Copy link
Copy Markdown
Contributor Author

Thanks @mtrootyy, I updated that section and opened an aria PR: w3c/html-aria#555

@annevk annevk added the topic: select The <select> element label Sep 15, 2025
Comment thread source Outdated
Comment thread source Outdated
@foolip
Copy link
Copy Markdown
Member

foolip commented Sep 16, 2025

@zcorpan do you want to review as well? It touches some things you've worked on I think.

@zcorpan
Copy link
Copy Markdown
Member

zcorpan commented Sep 17, 2025

Looks good.

I think some things can be tested, e.g. with reftest you can check that <select multiple> is the same as <select multiple size=4>, and that <select multiple size=1 style="field-sizing: content"><option>foo</select> != <select multiple size=4 style="field-sizing: content"><option>foo</select>

@josepharhar
Copy link
Copy Markdown
Contributor Author

Looks good.

I think some things can be tested, e.g. with reftest you can check that <select multiple> is the same as <select multiple size=4>, and that <select multiple size=1 style="field-sizing: content"><option>foo</select> != <select multiple size=4 style="field-sizing: content"><option>foo</select>

Thanks! I am adding a WPT that does this.

@annevk
Copy link
Copy Markdown
Member

annevk commented Sep 25, 2025

This PR allows select elements with the multiple attribute to be rendered as a drop-down box when the author explicitly sets the size attribute to 1.

What should happen on platforms that don't have this capability?

@josepharhar
Copy link
Copy Markdown
Contributor Author

This PR allows select elements with the multiple attribute to be rendered as a drop-down box when the author explicitly sets the size attribute to 1.

What should happen on platforms that don't have this capability?

In chromium, I am implementing this as a popover inside the shadowroot of the select element for desktop platforms. We have also been using a web-based popup document for the single-select picker on windows and linux for as long as I know. By implementing it this way, platform capability doesn't matter, and we could switch it to a native platform implementation later if we want to, as we did for single-select on MacOS.

If we have to carve out an exception in the spec while we wait for MacOS to implement this picker in order to get this PR merged, then we could change it to say that <select multiple size=1> may be either list box or drop down depending on the UA, unlike the other modes that are more well defined.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Sep 30, 2025
It was pointed out that we could write interoperable WPTs for the native
appearance this way:
whatwg/html#11460 (comment)

Bug: 439964654
Change-Id: Iaba3a475cf6f5414619ef7e081e1f257a41a6f01
aarongable pushed a commit to chromium/chromium that referenced this pull request Oct 1, 2025
It was pointed out that we could write interoperable WPTs for the native
appearance this way:
whatwg/html#11460 (comment)

Bug: 439964654
Change-Id: Iaba3a475cf6f5414619ef7e081e1f257a41a6f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967020
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1523858}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 1, 2025
It was pointed out that we could write interoperable WPTs for the native
appearance this way:
whatwg/html#11460 (comment)

Bug: 439964654
Change-Id: Iaba3a475cf6f5414619ef7e081e1f257a41a6f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967020
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1523858}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Oct 1, 2025
It was pointed out that we could write interoperable WPTs for the native
appearance this way:
whatwg/html#11460 (comment)

Bug: 439964654
Change-Id: Iaba3a475cf6f5414619ef7e081e1f257a41a6f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967020
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1523858}
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Oct 14, 2025
…a=testonly

Automatic update from web-platform-tests
Add WPTs for SelectMobileDesktopParity

It was pointed out that we could write interoperable WPTs for the native
appearance this way:
whatwg/html#11460 (comment)

Bug: 439964654
Change-Id: Iaba3a475cf6f5414619ef7e081e1f257a41a6f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967020
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1523858}

--

wpt-commits: 47cbbd49085203c27392abcea9560b372593dd6e
wpt-pr: 55167
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 16, 2025
…a=testonly

Automatic update from web-platform-tests
Add WPTs for SelectMobileDesktopParity

It was pointed out that we could write interoperable WPTs for the native
appearance this way:
whatwg/html#11460 (comment)

Bug: 439964654
Change-Id: Iaba3a475cf6f5414619ef7e081e1f257a41a6f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967020
Reviewed-by: Dominic Farolino <domchromium.org>
Commit-Queue: Joey Arhar <jarharchromium.org>
Cr-Commit-Position: refs/heads/main{#1523858}

--

wpt-commits: 47cbbd49085203c27392abcea9560b372593dd6e
wpt-pr: 55167

UltraBlame original commit: 7602c064ac7e95276637e9ac040d27597b59f75d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 16, 2025
…a=testonly

Automatic update from web-platform-tests
Add WPTs for SelectMobileDesktopParity

It was pointed out that we could write interoperable WPTs for the native
appearance this way:
whatwg/html#11460 (comment)

Bug: 439964654
Change-Id: Iaba3a475cf6f5414619ef7e081e1f257a41a6f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967020
Reviewed-by: Dominic Farolino <domchromium.org>
Commit-Queue: Joey Arhar <jarharchromium.org>
Cr-Commit-Position: refs/heads/main{#1523858}

--

wpt-commits: 47cbbd49085203c27392abcea9560b372593dd6e
wpt-pr: 55167

UltraBlame original commit: 7602c064ac7e95276637e9ac040d27597b59f75d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 16, 2025
…a=testonly

Automatic update from web-platform-tests
Add WPTs for SelectMobileDesktopParity

It was pointed out that we could write interoperable WPTs for the native
appearance this way:
whatwg/html#11460 (comment)

Bug: 439964654
Change-Id: Iaba3a475cf6f5414619ef7e081e1f257a41a6f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967020
Reviewed-by: Dominic Farolino <domchromium.org>
Commit-Queue: Joey Arhar <jarharchromium.org>
Cr-Commit-Position: refs/heads/main{#1523858}

--

wpt-commits: 47cbbd49085203c27392abcea9560b372593dd6e
wpt-pr: 55167

UltraBlame original commit: 7602c064ac7e95276637e9ac040d27597b59f75d
mertcanaltin pushed a commit to mertcanaltin/wpt that referenced this pull request Oct 26, 2025
It was pointed out that we could write interoperable WPTs for the native
appearance this way:
whatwg/html#11460 (comment)

Bug: 439964654
Change-Id: Iaba3a475cf6f5414619ef7e081e1f257a41a6f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967020
Reviewed-by: Dominic Farolino <dom@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1523858}
@josepharhar
Copy link
Copy Markdown
Contributor Author

@annevk if I changed the definition of <select multiple size=1> to be either listbox or dropdown box depending on the platform, would that be sufficient?

@josepharhar
Copy link
Copy Markdown
Contributor Author

I pushed a commit to make <select multiple size=1> either a listbox or a dropdown box depending on platform support. How does it look?

@josepharhar
Copy link
Copy Markdown
Contributor Author

I could also rewrite it as an algorithm and/or add a table which shows select with different attributes and what their display type becomes

Comment thread source Outdated
Comment thread source Outdated
@josepharhar
Copy link
Copy Markdown
Contributor Author

@annevk Would you mind taking another look at this?

Copy link
Copy Markdown
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Apologies for the delay here, this looks good now. Once you complete OP I'll merge.

@annevk annevk merged commit d59fb13 into whatwg:main Mar 11, 2026
2 checks passed
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Apr 1, 2026
Now that the spec PR has been merged, we can remove tentative from these
tests: whatwg/html#11460

This patch also adds another test to make sure that <select size=2> is
rendered as a listbox instead of a drop-down box.

Bug: 439964654
Change-Id: I08cc9b0ddc6940f1c42c0680e033b5ed1df5d09f
beckysiegel pushed a commit to chromium/chromium that referenced this pull request Apr 1, 2026
Now that the spec PR has been merged, we can remove tentative from these
tests: whatwg/html#11460

This patch also adds another test to make sure that <select size=2> is
rendered as a listbox instead of a drop-down box.

Bug: 439964654
Change-Id: I08cc9b0ddc6940f1c42c0680e033b5ed1df5d09f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7682757
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1608215}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Apr 1, 2026
Now that the spec PR has been merged, we can remove tentative from these
tests: whatwg/html#11460

This patch also adds another test to make sure that <select size=2> is
rendered as a listbox instead of a drop-down box.

Bug: 439964654
Change-Id: I08cc9b0ddc6940f1c42c0680e033b5ed1df5d09f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7682757
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1608215}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Apr 1, 2026
Now that the spec PR has been merged, we can remove tentative from these
tests: whatwg/html#11460

This patch also adds another test to make sure that <select size=2> is
rendered as a listbox instead of a drop-down box.

Bug: 439964654
Change-Id: I08cc9b0ddc6940f1c42c0680e033b5ed1df5d09f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7682757
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1608215}
lando-worker Bot pushed a commit to mozilla-firefox/firefox that referenced this pull request Apr 17, 2026
…tentative, a=testonly

Automatic update from web-platform-tests
Make SelectMobileDesktopParity WPTs non-tentative

Now that the spec PR has been merged, we can remove tentative from these
tests: whatwg/html#11460

This patch also adds another test to make sure that <select size=2> is
rendered as a listbox instead of a drop-down box.

Bug: 439964654
Change-Id: I08cc9b0ddc6940f1c42c0680e033b5ed1df5d09f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7682757
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: David Baron <dbaron@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1608215}

--

wpt-commits: ecc460f6fc45a3da33e3ac9add74b584b845608a
wpt-pr: 58895
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agenda+ To be discussed at a triage meeting topic: select The <select> element

Development

Successfully merging this pull request may close these issues.

Rendering <select> as a listbox is a one-line widget that opens a popup on iOS and Android

5 participants