Skip to content

Conversation

@josepharhar
Copy link
Contributor

@josepharhar josepharhar commented Nov 6, 2025

This PR makes sure that the contents of the selectedcontent element stay up to date when the selected option is changed in the selectedness setting algorithm.

This issue was found here: web-platform-tests/wpt#55849 (comment)

Fixes #11883 (comment)

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


/form-elements.html ( diff )

This PR makes sure that the contents of the selectedcontent element stay
up to date when the selected option is changed in the selectedness
setting algorithm.

This issue was found here:
web-platform-tests/wpt#55849 (comment)
last <code>option</code> element with its <span
data-x="concept-option-selectedness">selectedness</span> set to true in the <span
data-x="concept-select-option-list">list of options</span> in <span>tree order</span> to
false.</p></li>
Copy link
Member

Choose a reason for hiding this comment

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

This reads a bit ambiguous to me. Maybe:

Set the selectedness of all option elements whose selectedness is true in the list of options to false, exception for the last one.

Perhaps it's okay as-is though. @zcorpan @domfarolino @noamr thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

I like your proposed wording, but do we even need to specify the ones with selectedness to true? How about:

Set the selectedness of all option elements in the list of options to false, exception for the last one in tree order.

This should be the same, but is more concise, and keeps the tree order condition, which I think is nice.

Copy link
Member

Choose a reason for hiding this comment

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

It's not the same. If we have true, true, false we would go to false, false, false with your wording. Whereas we want false, true, false.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I agree, I find it hard to read.

How about something like:

Let |options| be element's list of options.
Let |currentlySelectedOptions| be the options in |options| whose selectedness is true
... make the rest of the checks on |options" and on |currentlySelectedOptions|

Copy link
Member

Choose a reason for hiding this comment

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

There's now also #12083 which is quite a bit clearer for this particular problem, but I'm not sure how it all relates anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I am going to make it a clearer algorithm. I think we can proceed in a couple different ways:

  1. Continue with this PR and 12083. I can deal with the merge conflicts for whichever gets merged first/second.
  2. Create a third PR which doesn't change behavior but changes this algorithm to make it easier to read and modify which doesn't change behavior. This PR and 12083 would be rebased on that one.
  3. Combine this PR with 12083 so there is only one PR.

Which would you prefer @annevk?

@annevk annevk added the topic: select The <select> element label Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: select The <select> element

Development

Successfully merging this pull request may close these issues.

<form>.reset() does not reset <selectedcontent>

4 participants