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

Update content model for customizable select #10586

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

josepharhar
Copy link
Contributor

@josepharhar josepharhar commented Aug 28, 2024

This PR updates the content model for the <select>, <option>, and <optgroup> elements in support of customizable <select>.

Fixes #10317

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


/dom.html ( diff )
/form-elements.html ( diff )
/grouping-content.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/rendering.html ( diff )
/scripting.html ( diff )
/text-level-semantics.html ( diff )

This PR updated the content model for the <select>, <option>, and
<optgroup> elements in support of customizable <select>.

Fixes whatwg#10317
@zcorpan zcorpan self-requested a review September 12, 2024 16:07
@zcorpan
Copy link
Member

zcorpan commented Sep 16, 2024

Is the idea to allow <select><div><h1><option> and such? Or only <select><div><div><option>?

If the former, you need to change the definition of phrasing content to include "option (if it is a descendant of a select element), optgroup (if it is a descendant of a select element)".

If the latter, you need to change the content model if div and span to switch on whether there's an ancestor select element, and if so allow "select element inner content elements". (But still disallow nesting of optgroup and option)

@zcorpan zcorpan mentioned this pull request Sep 16, 2024
5 tasks
@josepharhar
Copy link
Contributor Author

Is the idea to allow <select><div><h1><option> and such? Or only <select><div><div><option>?

If the former, you need to change the definition of phrasing content to include "option (if it is a descendant of a select element), optgroup (if it is a descendant of a select element)".

If the latter, you need to change the content model if div and span to switch on whether there's an ancestor select element, and if so allow "select element inner content elements". (But still disallow nesting of optgroup and option)

h1 elements are not supposed to be part of the content model, so I implemented the div and span switching by pulling out the content models for option and optgroup and using them in div and span.

Copy link
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.

This could use some examples. Or are we adding those as part of another PR?

scottaohara added a commit to w3c/aria that referenced this pull request Oct 22, 2024
In regards to the updated content model for the select element and its allowed children, an `optgroup` can have a `legend` element as its first child, and this `legend` needs to be able to name the `optgroup` similarly to how a `legend` names a `fieldset`.

see:
whatwg/html#10586
aarongable pushed a commit to chromium/chromium that referenced this pull request Nov 25, 2024
This CL adds checks for attributes tabindex and contenteditable of
<option> descendants. Tests are introduced to verify behavior.

Checks based on whatwg/html#10586
Part 3 based on https://chromium-review.googlesource.com/c/chromium/src/+/5906182

Bug: 347890366
Change-Id: Ie4e4e7b655aeacc9d7e95067d17172c7869aa003
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6044294
Commit-Queue: Ana Sollano Kim <[email protected]>
Reviewed-by: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1387905}
@josepharhar
Copy link
Contributor Author

This could use some examples. Or are we adding those as part of another PR?

I started a follow up here: https://github.com/whatwg/html/compare/main...josepharhar:html:selectexamples?expand=1

@scottaohara
Copy link
Collaborator

This could use some examples. Or are we adding those as part of another PR?

I started a follow up here: https://github.com/whatwg/html/compare/main...josepharhar:html:selectexamples?expand=1

thanks @josepharhar - give me a shout when these are finished, and i can help review and/or add on as need be.

@josepharhar
Copy link
Contributor Author

In order to resolve the remaining two open comment threads, I added notes about the content model:

I originally had notes about the content model which were placed directly after the content model itself, but I was told not to do that and to put the notes where the prose about the content model is. I'm not sure where such prose exists, so I just added the notes to the very end of the option element and select element sections: #10586 (comment)

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.

Content model and 'what' to render for stylable <select> elements
7 participants