-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Define the <selectedcontent>
element
#10633
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
base: main
Are you sure you want to change the base?
Conversation
The `<selectedoption>` element is part of the customizable `<select>` proposal: whatwg#9799 It allows authors to declaratively clone the contents of the currently selected `<option>` of a `<select>` and style it independently for use in a base appearance `<select>`'s button. The timing of cloning has been discussed here: whatwg#10520 The selectedoption element has been discussed generally here: w3c/csswg-drafts#10242
It seems this is missing a lot of the boilerplate that new elements normally have as well as changes to content models, indexes, etc. See also this checklist at the top of
|
I recreated the [original PR](w3c/html-aam#566) by @josepharhar The `<selectedoption>` element is part of the [customizable select feature](whatwg/html#9799) and is being added to HTML [here](whatwg/html#10633). ## Implementation * WPT tests: web-platform-tests/wpt#45096 * Implementations (link to issue or when done, link to commit): * WebKit: TODO * Gecko: TODO * Blink: https://chromium.googlesource.com/chromium/src/+/18b5eac27b14b409503aa8047cf9358082a0e0df Co-authored-by: Joey Arhar @josepharhar
Thanks!
|
This still seems incomplete. Where does the |
Thanks, I updated the content model of the button element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still LGTM; there are two things I'd like to see:
- @josepharhar: could you address Define the
<selectedcontent>
element #10633 (review) by adding some detail to the commit message in the OP, especially around the cloning strategy we ultimately went with and how it relates to the discussion in Timing of cloning for the<selectedoption>
element #10520? - @scottaohara: how do you feel about Add
selectedcontent
element and allowances for 'button' part of select w3c/html-aria#528 and [html-aam] Addition: selectedcontent element w3c/aria#2344? Do you think those are ready to land at this point, and are just waiting on this PR?
Once I get some clarity on these two I think we're ready to land this; I will hold off until the end of the week.
Done. Copying into this comment too in case the commit message gets clobbered by the thing that updates the commit message with the build of the PR: Some details on the cloning behavior, which were decided on in order to always make sure that the selectedcontent element is up to date and in order to reduce developer confusion:
|
source
Outdated
|
||
<p w-dev>Every time the selected <code>option</code> of a <code>select</code> switches from one | ||
option to another, the <code>selectedcontent</code> element removes all of its children and | ||
replaces them with a new cloned copy of the DOM structure of the <code>select</code>'s selected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"cloned copy" is a pleonasm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I removed "cloned". How does it look now?
source
Outdated
|
||
<ol> | ||
<li><p>Let <var>childClone</var> be the result of running <span | ||
data-x="concept-node-clone">clone</span> given <var>child</var>, null, true.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and true?
But also, I don't think this works anymore now that concept-node-clone has named arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I changed it to use named arguments. How does it look?
@domfarolino sorry, I missed your mention of me since I've already been mentioned in this thread, github doesn't make it clear when someone has been re-mentioned. the html aam (2344) PR is waiting on this to merge. It hasn't had any updates since I made some wording changes to a note in February. There are various other HTML AAM PRs related to customizable select which are also ready to go once everything is ready to merge into the HTML spec. the aria in html pr (528) is essentially ready to go as well. No more spec updates needed, just some issues to file against conformance checkers. |
@josepharhar not sure if this is the PR to comment on or not, but per our chat discussion it's probably worth calling out that while Someone can still benefit from broader styling capabilities and still define option element label text using the attribute if their customized select does not contain a button part (and thus no selectedcontent element). Maybe it makes sense to call this out? that way, if someone does attempt to use label attributes when defining their options, it's made clear "if you want to do this, then you shouldn't use the button part/selectedconent elements. but, to have greater control, use child content of the option to define your labels, which will also allow for more styling capabilities for represented the selected content in the select's collapsed state. or you know... word smith as you see fit |
Thanks Scott! I added a note here: bcd9669 |
These were requested here: whatwg/html#10633 (comment) There are failing test expectations added for the virtual test suites where CustomizableSelect is disabled, where the <selectedcontent> element is not enabled. Change-Id: Ib2906a5c8d70ae5ea5cccb6d899c79b29ea45e5e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471702 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1458866}
These were requested here: whatwg/html#10633 (comment) There are failing test expectations added for the virtual test suites where CustomizableSelect is disabled, where the <selectedcontent> element is not enabled. Change-Id: Ib2906a5c8d70ae5ea5cccb6d899c79b29ea45e5e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471702 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1458866}
These were requested here: whatwg/html#10633 (comment) There are failing test expectations added for the virtual test suites where CustomizableSelect is disabled, where the <selectedcontent> element is not enabled. Change-Id: Ib2906a5c8d70ae5ea5cccb6d899c79b29ea45e5e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471702 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1458866}
…content>, Automatic update from web-platform-tests Add MutationObserver tests for <selectedcontent> These were requested here: whatwg/html#10633 (comment) There are failing test expectations added for the virtual test suites where CustomizableSelect is disabled, where the <selectedcontent> element is not enabled. Change-Id: Ib2906a5c8d70ae5ea5cccb6d899c79b29ea45e5e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471702 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1458866} -- wpt-commits: 23b9c427c9115a1b40b95e4e4099c353a985c958 wpt-pr: 52476 Differential Revision: https://phabricator.services.mozilla.com/D249370
…content>, Automatic update from web-platform-tests Add MutationObserver tests for <selectedcontent> These were requested here: whatwg/html#10633 (comment) There are failing test expectations added for the virtual test suites where CustomizableSelect is disabled, where the <selectedcontent> element is not enabled. Change-Id: Ib2906a5c8d70ae5ea5cccb6d899c79b29ea45e5e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471702 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1458866} -- wpt-commits: 23b9c427c9115a1b40b95e4e4099c353a985c958 wpt-pr: 52476 Differential Revision: https://phabricator.services.mozilla.com/D249370
…content>, Automatic update from web-platform-tests Add MutationObserver tests for <selectedcontent> These were requested here: whatwg/html#10633 (comment) There are failing test expectations added for the virtual test suites where CustomizableSelect is disabled, where the <selectedcontent> element is not enabled. Change-Id: Ib2906a5c8d70ae5ea5cccb6d899c79b29ea45e5e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471702 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Dominic Farolino <[email protected]> Cr-Commit-Position: refs/heads/main@{#1458866} -- wpt-commits: 23b9c427c9115a1b40b95e4e4099c353a985c958 wpt-pr: 52476 Differential Revision: https://phabricator.services.mozilla.com/D249370
…content>, Automatic update from web-platform-tests Add MutationObserver tests for <selectedcontent> These were requested here: whatwg/html#10633 (comment) There are failing test expectations added for the virtual test suites where CustomizableSelect is disabled, where the <selectedcontent> element is not enabled. Change-Id: Ib2906a5c8d70ae5ea5cccb6d899c79b29ea45e5e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471702 Commit-Queue: Joey Arhar <jarharchromium.org> Reviewed-by: Dominic Farolino <domchromium.org> Cr-Commit-Position: refs/heads/main{#1458866} -- wpt-commits: 23b9c427c9115a1b40b95e4e4099c353a985c958 wpt-pr: 52476 Differential Revision: https://phabricator.services.mozilla.com/D249370 UltraBlame original commit: c92c496cf3b9513fb0279fdb8afa468388d866ff
…content>, Automatic update from web-platform-tests Add MutationObserver tests for <selectedcontent> These were requested here: whatwg/html#10633 (comment) There are failing test expectations added for the virtual test suites where CustomizableSelect is disabled, where the <selectedcontent> element is not enabled. Change-Id: Ib2906a5c8d70ae5ea5cccb6d899c79b29ea45e5e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471702 Commit-Queue: Joey Arhar <jarharchromium.org> Reviewed-by: Dominic Farolino <domchromium.org> Cr-Commit-Position: refs/heads/main{#1458866} -- wpt-commits: 23b9c427c9115a1b40b95e4e4099c353a985c958 wpt-pr: 52476 Differential Revision: https://phabricator.services.mozilla.com/D249370 UltraBlame original commit: c92c496cf3b9513fb0279fdb8afa468388d866ff
…content>, Automatic update from web-platform-tests Add MutationObserver tests for <selectedcontent> These were requested here: whatwg/html#10633 (comment) There are failing test expectations added for the virtual test suites where CustomizableSelect is disabled, where the <selectedcontent> element is not enabled. Change-Id: Ib2906a5c8d70ae5ea5cccb6d899c79b29ea45e5e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6471702 Commit-Queue: Joey Arhar <jarharchromium.org> Reviewed-by: Dominic Farolino <domchromium.org> Cr-Commit-Position: refs/heads/main{#1458866} -- wpt-commits: 23b9c427c9115a1b40b95e4e4099c353a985c958 wpt-pr: 52476 Differential Revision: https://phabricator.services.mozilla.com/D249370 UltraBlame original commit: c92c496cf3b9513fb0279fdb8afa468388d866ff
Per mdn/content#39411; "Dynamic modifications to the selected This has usability and security risks. If the option can be updated without the content of the We don't want to add anything to the web platform that may potentially break things, make a form control less accessible, or add any vulnerabilities. |
The
<selectedcontent>
element is part of the customizable<select>
proposal: #9799It allows authors to declaratively clone the contents of the currently selected
<option>
of a<select>
and style it independently for use in a base appearance<select>
's button.Some details on the cloning behavior, which were decided on in order to always make sure that the selectedcontent element is up to date and in order to reduce developer confusion:
</option>
end tag is parsed during HTML parsing.Fixes #10520
The selectedcontent element has been discussed generally here: w3c/csswg-drafts#10242
html-aria PR: w3c/html-aria#528
html-aam PR: w3c/aria#2344
(See WHATWG Working Mode: Changes for more details.)
/form-control-infrastructure.html ( diff )
/form-elements.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/interactive-elements.html ( diff )
/parsing.html ( diff )