-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Define base appearance for <select> #10629
base: main
Are you sure you want to change the base?
Conversation
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.
I'm missing the base appearance style sheet?
source
Outdated
<ol> | ||
<li> | ||
<p>For each <var>ancestor</var> of <var>option</var>'s <span | ||
data-x="ancestor">ancestors</span>:</p> |
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.
I guess the order technically doesn't matter, but seems good to specify still in case of future changes.
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.
I want it to start at option's parent and go up in the tree from there. How should I specify this?
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.
reverse tree order?
source
Outdated
<ol> | ||
<li> | ||
<p>For each <var>ancestor</var> of <var>element</var>'s <span | ||
data-x="ancestor">ancestors</span>:</p> |
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.
Here the order seems like it actually matters.
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.
I want it to start at option's parent and go up in the tree from there. How should I specify this?
source
Outdated
|
||
<p>Whenever an <code>option</code> <var>option</var>'s <span | ||
data-x="concept-option-selectedness">selectedness</span> is set to true, run <span>maybe clone | ||
option into select button</span> given <var>option</var>.</p> |
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 seems weird. Normally changing members doesn't have weird side effects like this.
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.
I moved this to the send select update notifications algorithm
source
Outdated
|
||
<p>When a <code>select</code> is being rendered as a <span>drop-down box</span> with a <span>base | ||
appearance</span>, it is expected to render as if it has the following <span>shadow | ||
root</span>:</p> |
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.
You can't define a shadow root in terms of an HTML syntax fragment.
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 rewrote it without using HTML. How does it look?
source
Outdated
HTML:</p> | ||
|
||
<!-- TODO is it OK for me to use <ul>, <li>, and <p> like this even though it isn't an | ||
algorithm? --> |
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.
I think the problem is really with how you define the shadow root. If you do that differently this will be different too. But you can use lists outside of algorithms for sure.
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 rewrote this and used it to replace the HTML. How does it look?
source
Outdated
|
||
<p>The <span>implicit anchor element</span> of the <span>select popover</span> element is the | ||
<code>select</code> element shadow host of the shadow host in which <span>select popover</span> | ||
resides.</p> |
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.
I can't parse this.
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.
Yeah that was not worded well. I rewrote it, how does it look now?
source
Outdated
|
||
<li><p>Set <var>select</var>'s <span>select popover slot</span>'s <span>manually assigned | ||
nodes</span> to <var>otherChildren</var>.</p></li> | ||
</ol> |
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.
Why can't we describe this more similarly to the details
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.
Ok, I replaced this algorithm with some prose at the definition of the slot elements to look more like the details element.
Thanks for the review! I just pushed a lot of changes.
I have a separate PR for that here: #10670 I can get rid of that PR and include it in this PR if you'd prefer. |
@@ -54363,6 +54374,64 @@ interface <dfn interface>HTMLOptionElement</dfn> : <span>HTMLElement</span> { | |||
|
|||
</div> | |||
|
|||
<p>To get the <dfn>option element ancestor select</dfn> given an <code>option</code> |
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.
option element but select without qualifier seems a bit odd. Also option
needs code
here I think.
And then after the algorithm you just say option without the element qualifier. I think that needs the qualifier too.
<li><p>Return null.</p></li> | ||
</ol> | ||
|
||
<p>To <dfn>clone selected option into select button</dfn>, given a <code>select</code> 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 has a similar problem.
<li><p>Let <var>option</var> be the first element of <var>select</var>'s <span | ||
data-x="concept-select-option-list">option list</span> whose <span | ||
data-x="concept-option-selectedness">selectedness</span> is set to true, if such an element | ||
exists, otherwise null.</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.
; otherwise null
(see Infra)
data-x="concept-option-selectedness">selectedness</span> is set to true, if such an element | ||
exists, otherwise null.</p></li> | ||
|
||
<li><p>Let <var>text</var> be an empty string.</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.
the empty string
<var>text</var>.</p></li> | ||
</ol> | ||
|
||
<p>The <span>activation behavior</span> of an <code>option</code> <var>option</var> is to run the |
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.
option element
<var>text</var>.</p></li> | ||
</ol> | ||
|
||
<p>The <span>activation behavior</span> of an <code>option</code> <var>option</var> is to run the |
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.
In the current Canary, option element selection seems to happen on pointerdown (or is it mousedown, anyhow -down), not when activating
(which is why it took a bit time to figure out why an anchor element inside an option doesn't get activated when clicked).
But click event is still dispatched. It is just dispatched to the common ancestor of the option and whatever happens to be under the pointer when the popup has been closed and pointerup dispatched.
<li><p>A <dfn>select button slot</dfn>, which is a <code>slot</code> element. It is appended to | ||
the <code>select</code>'s <span>shadow root</span> as the first child. It is expected to take the | ||
first child element of the <code>select</code> if the first child element is a | ||
<code>button</code>, otherwise the <span>select fallback button text</span>.</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.
When testing Canary the select element seems to eat the click event and a button nor selectedcontent inside it get the click. Is that defined somewhere? Hmm, looks like they don't get any pointer/mouse events. Perhaps there is pointer-events: none somewhere, I'm just missing to find that in the PRs?
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.
Ah, the selectedcontent/button case is coming from interactivity: inert;
w3c/csswg-drafts#10857
w3c/csswg-drafts#11178
This PR defines the base appearance except for the UA stylesheet for customizable select as proposed in #9799
Base appearance is being defined in CSS here: w3c/csswg-drafts#10691
(See WHATWG Working Mode: Changes for more details.)
/form-control-infrastructure.html ( diff )
/form-elements.html ( diff )
/infrastructure.html ( diff )
/references.html ( diff )
/rendering.html ( diff )