From 8e171386857e6998920e19952259c6d9c7a720b5 Mon Sep 17 00:00:00 2001
From: Joey Arhar
Run maybe clone option into select button given + insertedNode.
The removing steps for the HTML Standard, given @@ -1838,6 +1841,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
If removedNode's popover
attribute is not in
the no popover state, then run the hide
popover algorithm given removedNode, false, false, and false.
Run maybe clone option into select button given + oldParent.
A The child concept
The following terms are defined in CSS Anchor Positioning: CSSANCHOR If element's node document is not fully active, then
return. If element's parent is a If element has a form owner then switch on element's To get the option element ancestor select given an For each ancestor of option's ancestors: If ancestor is a Return null. To maybe clone option into select button, given an For each ancestor of element's ancestors: If all of the following conditions are true: ancestor is an ancestor has a non-null option element ancestor
+ select; ancestor's option element ancestor select is rendered as a
+ drop-down box; ancestor's selectedness
+ is true, then set ancestor's option element ancestor select's select
+ fallback button text to the value of ancestor's label. Whenever an The activation behavior of an Let select be the option element ancestor select given
+ option. If select is null, then return. Set option's selectedness to
+ true. Set option's dirtiness to
+ true. Send If select is being rendered as a drop-down box with base
+ appearance: Run the hide popover algorithm given the first item in select's
+ select popover slot's assigned nodes.
+
@@ -53096,6 +53110,10 @@ interface HTMLButtonElement : HTMLElement {
select
element, then
+ show the picker, if applicable given element's parent and
+ return.type
attribute's state, then:option
+ option:
+
+
+
+
+ select
, then return
+ ancestor.Element
+ element:
+
+
+
+
+
+
+
+ option
element;option
option's selectedness is set to true, run maybe clone
+ option into select button given option.option
option is to run the
+ following steps:
+
+
select
update notifications given
+ select.
+
+
option.selected
optgroup
element children
providing headers for groups of options where applicable.
select
elements which render as a drop-down box support a base
+ appearance in addition to native appearance and primitive
+ appearance.
When a select
is being rendered as a drop-down box with a base
+ appearance, it is expected to render as if it has the following shadow
+ root:
<slot id="select-button-slot">
+ <div id="select-fallback-button-text"></div>
+</slot>
+<div id="select-popover" popover="auto">
+ <slot id="select-popover-slot"></slot>
+</div>
+
+ Since base appearance is determined by computing style, it isn't
+ possible to swap this DOM structure when switching appearance. Implementations can always include
+ the DOM structure for base appearance when the select
is rendered as a
+ drop-down box and then choose to include or exclude it from the layout tree in order
+ to control whether it gets rendered or not.
select
elements rendered as a drop-down box with base
+ appearance each contain the following elements as shown with ID attributes in the above
+ HTML:
A select button slot, which is a slot
.
Select fallback button text, which is a div
.
A select popover, which is a div
.
A select popover slot, which is a slot
.
The implicit anchor element of the select popover element is the
+ select
element shadow host of the shadow host in which select popover
+ resides.
The shadow root used for select
's drop-down box
+ base appearance must have its slot assignment set to "manual
". The shadow root must also have delegates focus
+ set to true if select button slot has an assigned node.
Without delegates focus set to true, the select
itself
+ would receive focus instead of the button
which is slotted into the select
+ button slot.
select
elements rendered as a drop-down box with base
+ appearance must render as if they are using manual slot assignment with the
+ following base select slotting algorithm to assign
+ their child nodes to slots. To perform the base select slotting algorithm, given a
+ select
element select:
Let firstButton be null.
Let otherChildren be « ».
For each Node
child in
+ select's children:
If child is a button
and firstButton is null, then set
+ firstButton to child.
Otherwise, append child to + otherChildren.
Set select's select button slot's manually assigned + nodes to firstButton.
Set select's select popover slot's manually assigned + nodes to otherChildren.
An optgroup
element is expected to be rendered by displaying the element's label
attribute.
An option
element is expected to be rendered by displaying the element's label, indented under its optgroup
element if it
- has one.
option
is being rendered in a select
which is being
+ rendered as a drop-down box with base appearance, then the
+ option
is expected to render all of its children rather than by displaying its label.
Each sequence of one or more child hr
element siblings may be rendered as a single
separator.
Run maybe clone option into select button given - insertedNode.
The removing steps for the HTML Standard, given @@ -1841,9 +1838,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
If removedNode's popover
attribute is not in
the no popover state, then run the hide
popover algorithm given removedNode, false, false, and false.
Run maybe clone option into select button given - oldParent.
A HTMLButtonElement : HTMLElement {
If element's node document is not fully active, then return.
If element's parent is a select
element, then
- show the picker, if applicable given element's parent and
- return.
If element has a form owner then switch on element's type
attribute's state, then:
select
element's user validity to true.Run clone selected option into select button given the select
+ element.
Fire an event named input
at the select
element, with the bubbles
and composed
@@ -54191,43 +54184,24 @@ interface HTMLOptionElement : HTMLElement {
Return null.
To maybe clone option into select button, given an Element
- element:
To clone selected option into select button, given a select
element
+ select:
For each ancestor of element's ancestors:
- -If all of the following conditions are true:
- -ancestor is an option
element;
ancestor has a non-null option element ancestor - select;
Let option be the first element of select's option list whose selectedness is set to true, if such an element + exists, otherwise null.
ancestor's option element ancestor select is rendered as a - drop-down box;
Let text be an empty string.
ancestor's selectedness - is true,
If option is not null, then set text to option's label.
then set ancestor's option element ancestor select's select - fallback button text to the value of ancestor's label.
-Set select's select fallback button text to + text.
Whenever an option
option's selectedness is set to true, run maybe clone
- option into select button given option.
The activation behavior of an option
option is to run the
following steps:
Send select
update notifications given
select.
If select is being rendered as a drop-down box with base - appearance:
- -Run the hide popover algorithm given the first item in select's - select popover slot's assigned nodes.
If select is being rendered as a drop-down box with base + appearance, then run the hide popover algorithm given select's + select popover.
optgroup
element children
providing headers for groups of options where applicable.
-
-
select
elements which render as a drop-down box support a base
appearance in addition to native appearance and primitive
appearance.
When a select
is being rendered as a drop-down box with a base
- appearance, it is expected to render as if it has the following shadow
- root:
<slot id="select-button-slot">
- <div id="select-fallback-button-text"></div>
-</slot>
-<div id="select-popover" popover="auto">
- <slot id="select-popover-slot"></slot>
-</div>
-
- Since base appearance is determined by computing style, it isn't
- possible to swap this DOM structure when switching appearance. Implementations can always include
- the DOM structure for base appearance when the select
is rendered as a
- drop-down box and then choose to include or exclude it from the layout tree in order
- to control whether it gets rendered or not.
select
elements rendered as a drop-down box with base
- appearance each contain the following elements as shown with ID attributes in the above
- HTML:
A select button slot, which is a slot
.
Select fallback button text, which is a div
.
A select popover, which is a div
.
A select popover slot, which is a slot
.
The implicit anchor element of the select popover element is the
- select
element shadow host of the shadow host in which select popover
- resides.
The shadow root used for select
's drop-down box
- base appearance must have its slot assignment set to "manual
". The shadow root must also have delegates focus
- set to true if select button slot has an assigned node.
Without delegates focus set to true, the select
itself
- would receive focus instead of the button
which is slotted into the select
- button slot.
select
elements rendered as a drop-down box with base
- appearance must render as if they are using manual slot assignment with the
- following base select slotting algorithm to assign
- their child nodes to slots. To perform the base select slotting algorithm, given a
- select
element select:
Let firstButton be null.
Let otherChildren be « ».
A select button slot, which is a slot
element. It is appended to
+ the select
's shadow root as the first child. It is expected to take the
+ first child element of the select
if the first child element is a
+ button
, otherwise the select fallback button text.
For each Node
child in
- select's children:
A select fallback button text, which is a div
element. It is
+ appended to the select button slot.
If child is a button
and firstButton is null, then set
- firstButton to child.
A select popover, which is a div
element. It is appended to the
+ select
's shadow root as the second child, after the select button
+ slot.
Otherwise, append child to - otherChildren.
A select popover slot, which is a slot
element. It is appended to
+ the select popover. It is expected to take all child nodes of the
+ select
except for the first child button
, which is taken by the
+ select button slot
.
Set select's select button slot's manually assigned - nodes to firstButton.
Since base appearance is determined by computing style, it isn't
+ possible to swap this DOM structure when switching appearance. Implementations can always include
+ the DOM structure for base appearance when the select
is rendered as a
+ drop-down box and then choose to include or exclude it from the layout tree in order
+ to control whether it gets rendered or not.
Set select's select popover slot's manually assigned - nodes to otherChildren.
The select popover's implicit anchor element is its associated
+ select
element.
An optgroup
element is expected to be rendered by displaying the element's label
attribute.
An option
element is expected to be rendered by displaying the element's label, indented under its optgroup
element if it
- has one. If the option
is being rendered in a select
which is being
- rendered as a drop-down box with base appearance, then the
- option
is expected to render all of its children rather than by displaying its option is in a select
which is being rendered as a
+ drop-down box with base appearance, and the option
's label
attribute is not set, then the option
is
+ expected to render all of its children rather than by displaying its label.
Each sequence of one or more child A hr
element siblings may be rendered as a single
From 85b785f6ff028d0f16bc5c8899d442df1c732d80 Mon Sep 17 00:00:00 2001
From: Joey Arhar form
element's default button is the first submit button in tree order whose form
- owner is that form
element.form
element and who is not slotted into a select
+ element's select button slot.
If the user agent supports letting the user submit a form implicitly (for example, on some
platforms hitting the "enter" key while a text control is focused implicitly submits
From 8dc3b0e27e65859c7911a1c0c456d4f4b17b6009 Mon Sep 17 00:00:00 2001
From: Joey Arhar For each ancestor of option's ancestors:
If ancestor is a Run clone selected option into select button given the Run clone selected Fire an event named To get the option element ancestor select given an To get the Return null. To clone selected option into select button, given a To clone selected Let option be the first element of select's HTMLOptionElement : HTMLElement {
following steps: Let select be the option element ancestor select given
- option. Let select be the If select is null, then return. Let option be the first element of select's option list whose selectedness is set to true, if such an element
- exists, otherwise null. Let text be an empty string. Let text be the empty string. If option is not null, then set text to option's label.select
, then return
From 46f457e53eb6065a36f219eddc923f39cc51dea7 Mon Sep 17 00:00:00 2001
From: Joey Arhar
select
element's user validity to true.select
- element.option
into select
button given
+ the select
element.input
at the select
element, with the HTMLOptionElement : HTMLElement {
-
option
- option:option
ancestor select
given an
+ option
option:
- select
element
- select:option
into select
button, given a
+ select
element select:
-
option
ancestor select
+ given option.
The activation behavior of an option
option is to run the
- following steps:
The activation behavior of an option
element option is to
+ run the following steps:
Let select be the option
ancestor select
From 72c006b164c74716aa7f5d270aa7250ae0ad087e Mon Sep 17 00:00:00 2001
From: Joey Arhar select
element's selectedness setting algorithm.
If the select
is being rendered as a drop-down box with base
+ appearance, then the user agent should allow the user to open the picker. Opening the picker will either fire a
+ corresponding mousedown
or keydown
event on the select
element. Calling
+ preventDefault()
on either of these events will
+ prevent the picker from opening. Otherwise, the picker is opened.
If the multiple
attribute is present, and the
element is not disabled, then the user agent should
allow the user to toggle the
Date: Thu, 5 Dec 2024 13:45:23 -0800
Subject: [PATCH 08/15] add arrow key events
---
source | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/source b/source
index d4c2fd8567d..8ec978a62b4 100644
--- a/source
+++ b/source
@@ -53841,6 +53841,53 @@ interface HTMLSelectElement : HTMLElement {
preventDefault()
on either of these events will
prevent the picker from opening. Otherwise, the picker is opened.
If the select
is being rendered as a drop-down box with base
+ appearance, then the user agent should allow the user to focus the next option and focus the previous option. Performing either of these
+ actions will fire a corresponding keydown
event on the
+ currently focused option
element. Calling preventDefault()
on this event will prevent the
+ corresponding algorithm from running.
To focus the next option given a currently
+ focused option
element option in a select
element
+ select:
While option is not null:
+ +Set option to the next element in select's list of options if any such element exists; + otherwise null.
If option is not null and is focusable, then run the + focusing steps given option and return.
To focus the previous option given a currently
+ focused option
element option in a select
element
+ select:
While option is not null:
+ +Set option to the previous element in select's list of options if any such element exists; + otherwise null.
If option is not null and is focusable, then run the + focusing steps given option and return.
If the multiple
attribute is present, and the
element is not disabled, then the user agent should
allow the user to toggle the
Date: Fri, 6 Dec 2024 12:30:40 -0800
Subject: [PATCH 09/15] replace activation behavior for options
---
source | 52 +++++++++++++++++++++++++---------------------------
1 file changed, 25 insertions(+), 27 deletions(-)
diff --git a/source b/source
index 8ec978a62b4..0e928448d04 100644
--- a/source
+++ b/source
@@ -53750,10 +53750,31 @@ interface HTMLSelectElement : HTMLElement {
through a click, or through unfocusing the element after changing its value, or through a menu command, or through any other mechanism), and before the
relevant user interaction event is queued (e.g. before the
- click
event), the user agent must set the selectedness of the picked option
element
- to true, set its dirtiness to true, and then
- send select
update notifications.
click
event), the user agent must run the pick an
+ option algorithm given the select
and the picked option
. If the
+ select
is being rendered with base appearance, then picking an option
will fire a corresponding keydown
or mouseup
event.
+ Calling preventDefault()
on either of these events
+ will prevent the pick an option algorithm from running.
+
+ To pick an option given a select
element select and an
+ option
element option:
Set option's selectedness to + true.
Set option's dirtiness to + true.
Send select
update notifications given
+ select.
If select is being rendered as a drop-down box with base + appearance, then run the hide popover algorithm given select's + select popover.
If the multiple
attribute is absent, whenever an
option
element in the select
element's HTMLOptionElement : HTMLElement {
text.
The activation behavior of an option
element option is to
- run the following steps:
Let select be the option
ancestor select
- given option.
If select is null, then return.
Set option's selectedness to - true.
Set option's dirtiness to - true.
Send select
update notifications given
- select.
If select is being rendered as a drop-down box with base - appearance, then run the hide popover algorithm given select's - select popover.
option.selected
If the select
is being rendered as a drop-down box with base
- appearance, then the user agent should allow the user to focus the next option and focus the previous option. Performing either of these
- actions will fire a corresponding keydown
event on the
- currently focused option
element. Calling preventDefault()
on this event will prevent the
- corresponding algorithm from running.
To focus the next option given a currently
- focused option
element option in a select
element
- select:
While option is not null:
- -Set option to the next element in select's list of options if any such element exists; - otherwise null.
If option is not null and is focusable, then run the - focusing steps given option and return.
To focus the previous option given a currently
- focused option
element option in a select
element
- select:
While option is not null:
- -Set option to the previous element in select's list of options if any such element exists; - otherwise null.
If option is not null and is focusable, then run the - focusing steps given option and return.
keydown
event
+ on the currently focused option
element, then run the focusing steps on
+ another option
within the select
. Calling preventDefault()
on the keydown
event will prevent the new option
from being
+ focused.
+
+ Implementations commonly allow the user to choose the next or previous option via + the arrow-up and arrow-down keys, or pick the first or last option via the Home or End keys.
If the multiple
attribute is present, and the
element is not disabled, then the user agent should
From 3c8e35df7c529cbbb17d3438cc753caa04db51b3 Mon Sep 17 00:00:00 2001
From: Joey Arhar option
from being
focused.
Implementations commonly allow the user to choose the next or previous option via - the arrow-up and arrow-down keys, or pick the first or last option via the Home or End keys.
+Implementations commonly allow the user to focus the next or previous option via + the arrow-up and arrow-down keys, focus the first or last option via the Home or End keys, or + focus the first or last option in the viewport of the picker via the PageUp or PageDown keys.
If the If the To pick an option given a The user agent should allow the user to pick an
+ To pick an option given a If select has the If event is not null and event's canceled flag is set,
+ then return. Set option's selectedness to
true. If the If event's canceled flag is set, then return. Run the show popover algorithm given select's select
+ popover, false, and select. If the If event's canceled flag is set, then return. Run the focusing steps on newOption. Implementations commonly allow the user to focus the next or previous option via
the arrow-up and arrow-down keys, focus the first or last option via the Home or End keys, or
From 45bbc64cbe522f36224b4e5d6a126fed30a6db18 Mon Sep 17 00:00:00 2001
From: Joey Arhar The following features are defined in CSS Forms:
+ CSSFORMS The following features are defined in CSS Grid Layout: CSSGRID To pick an option given a The When a A select popover, which is a A select popover slot, which is a The select popover is only rendered when it is opted in to base
+ appearance separately from the The select popover's implicit anchor element is its associated
An Each sequence of one or more child To get the For each ancestor of option's ancestors in reverse tree order: If ancestor is a Return null. To clone selected multiple
attribute is present, and the
element is not disabled, then the user agent should
From c151264d9b0eecbfbba2ce83501dd831178906be Mon Sep 17 00:00:00 2001
From: Joey Arhar multiple
attribute is absent, and the element
- is not disabled, then the user agent should allow the
- user to pick an option
element in its list
- of options that is itself not disabled. Upon
- this option
element being picked (either
- through a click, or through unfocusing the element after changing its value, or through a menu command, or through any other mechanism), and before the
- relevant user interaction event is queued (e.g. before the
- click
event), the user agent must run the pick an
- option algorithm given the select
and the picked option
. If the
- select
is being rendered with base appearance, then picking an option
will fire a corresponding keydown
or mouseup
event.
- Calling preventDefault()
on either of these events
- will prevent the pick an option algorithm from running.select
element select and an
- option
element option:option
element from a select
element in its list of options (either through a click, or through
+ unfocusing the element after changing its value, or through a menu
+ command, or through any other mechanism) by running the pick an option
+ algorithm given the select
element, the option
element, and if
+ select
is being rendered with base appearance, a corresponding keydown
or mouseup
event,
+ otherwise null.select
element select, an
+ option
element option, and an Event
or null
+ event:
+
multiple
attribute
+ or select is disabled, then return.select
is being rendered as a drop-down box with base
appearance, then the user agent should allow the user to open the picker. Opening the picker will either fire a
- corresponding mousedown
or keydown
event on the select
element. Calling
- preventDefault()
on either of these events will
- prevent the picker from opening. Otherwise, the picker is opened.select
+ element select and a corresponding mousedown
or
+ keydown
event event:
+
+
+
select
is being rendered as a drop-down box with base
- appearance, then the user agent should allow the user to focus another option.
- Performing this action will fire a corresponding keydown
event
- on the currently focused option
element, then run the focusing steps on
- another option
within the select
. Calling preventDefault()
on the keydown
event will prevent the new option
from being
- focused.option
element to focus option and a keydown
event event:
+
+
+
+
+
@@ -53748,9 +53756,9 @@ interface HTMLSelectElement : HTMLElement {
unfocusing the element after changing its value, or through a menu
command, or through any other mechanism) by running the pick an option
algorithm given the
select
element, the option
element, and if
- select
is being rendered with base appearance, a corresponding keydown
or mouseup
event,
- otherwise null.select
and its select popover are both being rendered with base
+ appearance, a corresponding keydown
or mouseup
event, otherwise null.
select
element select, an
option
element option, and an Event
or null
@@ -137310,6 +137318,11 @@ progress { appearance: auto; }
appearance in addition to native appearance and primitive
appearance.select
element's select popover supports a base
+ appearance and a native appearance. The select popover can only
+ be rendered with base appearance if its associated select
is being
+ rendered with base appearance.select
is being rendered as a drop-down box with a base
appearance, it is expected to render as if it has a shadow tree with the
following elements:div
element. It is appended to the
select
's shadow root as the second child, after the select button
- slot.select
element's picker pseudo-element is the
+ select popover.
slot
element. It is appended to
the select popover. It is expected to take all child nodes of the
@@ -137339,6 +137353,10 @@ progress { appearance: auto; }
drop-down box and then choose to include or exclude it from the layout tree in order
to control whether it gets rendered or not.select
element. Otherwise, a native picker is
+ used.select
element.option
element is expected to be rendered by displaying the element's label, indented under its optgroup
element if it
has one. If the option
is in a select
which is being rendered as a
- drop-down box with base appearance, and the option
's label
attribute is not set, then the option
is
- expected to render all of its children rather than by displaying its drop-down box with base appearance, and the select
's
+ select popover is being rendered with base appearance, and the
+ option
's label
attribute is not set, then the
+ option
is expected to render all of its children rather than by displaying its label.hr
element siblings may be rendered as a single
@@ -144856,6 +144875,9 @@ INSERT INTERFACES HERE
option
ancestor select
given an
- option
option:
-
-
-
- select
, then return
- ancestor.option
into select
button, given a
select
element select:select
is being
rendered with base appearance.
When a select
is being rendered as a drop-down box with a base
- appearance, it is expected to render as if it has a shadow tree with the
+
When a select
is being rendered as a drop-down box with base
+ appearance, it is expected to render with a shadow tree that contains the
following elements: