Update shadow root for nesting <input> in <select> [chromium/src : main]

0 views
Skip to first unread message

Joey Arhar (Gerrit)

unread,
May 7, 2026, 12:50:32 PM (5 days ago) May 7
to Mason Freed, (Julie)Jeongeun Kim, Kevin Babbitt, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, devtools-re...@chromium.org, francisjp...@google.com, blink-rev...@chromium.org, dtseng...@chromium.org, blink-rev...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, lucasrada...@google.com, yuzo+...@chromium.org, abigailbk...@google.com, blink-...@chromium.org
Attention needed from Mason Freed

Joey Arhar voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Mason Freed
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I3bcefdf33454a1f2fe5f1e858ef511c628a51bb4
Gerrit-Change-Number: 7804742
Gerrit-PatchSet: 9
Gerrit-Owner: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
Gerrit-Attention: Mason Freed <mas...@chromium.org>
Gerrit-Comment-Date: Thu, 07 May 2026 16:50:16 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Mason Freed (Gerrit)

unread,
May 11, 2026, 3:04:08 PM (21 hours ago) May 11
to (Julie)Jeongeun Kim, Kevin Babbitt, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, devtools-re...@chromium.org, francisjp...@google.com, blink-rev...@chromium.org, dtseng...@chromium.org, blink-rev...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, lucasrada...@google.com, yuzo+...@chromium.org, abigailbk...@google.com, blink-...@chromium.org
Attention needed from Joey Arhar

Mason Freed voted and added 15 comments

Votes added by Mason Freed

Code-Review+1

15 comments

Patchset-level comments
File-level comment, Patchset 11 (Latest):
Mason Freed . resolved

LGTM! Lots of comments, but most are small

File third_party/blink/renderer/core/html/forms/html_select_element.cc
Line 816, Patchset 11 (Latest): return content_model_violations_count_ > 0U;
Mason Freed . unresolved

nit: just `return content_model_violations_count_;`

Line 1570, Patchset 11 (Latest): UserAgentShadowRoot()->SetNeedsAssignmentRecalc();
Mason Freed . unresolved

Why is this needed? I'd have thought that the node removal at line 1567 would be enough. Is it because something is missing on ShadowRoot for this, perhaps? E.g. we have [Element::ChildrenChanged()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/dom/element.cc;l=7824;drc=3da6fd070ba13b34eba5bc5bb3fd0bb6c2d1797f) which takes care of this for normal removals.

Line 2147, Patchset 11 (Latest): if (num_descendant_inputs_ == 1) {
Mason Freed . unresolved

== 1 ? I'm guessing this is because we don't need to change the shadow structure after 1. Perhaps add a comment?

Line 2155, Patchset 11 (Latest): if (num_descendant_inputs_ == 0) {
Mason Freed . unresolved

nit: `!num_descendant_inputs_`

Line 2180, Patchset 11 (Latest): UserAgentShadowRoot()->SetNeedsAssignmentRecalc();
Mason Freed . unresolved

Again, here, it feels weird to have to manually call this. Do we know why it's needed?

Line 2206, Patchset 11 (Latest): UserAgentShadowRoot()->SetNeedsAssignmentRecalc();
Mason Freed . unresolved

ditto

File third_party/blink/renderer/core/html/forms/html_select_element_test.cc
Line 1160, Patchset 11 (Latest): EXPECT_TRUE(!!input_slot());
Mason Freed . unresolved

It feels a little weird to validate that the UpdateStyleAndLayout creates it. Maybe ok to leave, but it'll break if, e.g. we happen to update style and layout from the callbacks that happen above this point.

File third_party/blink/renderer/core/html/forms/select_type.cc
Line 632, Patchset 11 (Latest): // <div role=listbox>
Mason Freed . unresolved

uber-nit: close this `</div>`

Line 647, Patchset 11 (Latest): popover_input_slot_ = nullptr;
Mason Freed . unresolved

Maybe `CHECK(!select_->NumDescendantInputs())` ?

Line 681, Patchset 11 (Latest): auto it = select_->ChildrenDescendantCounts().find(&child);
Mason Freed . unresolved

Perhaps `DCHECK(!!popover_input_slot_)` ?

Line 683, Patchset 11 (Latest): if (it->value.num_inputs && !it->value.num_options) {
Mason Freed . unresolved

Maybe add a comment that the other situation (we have both) is handled elsewhere?

Line 705, Patchset 11 (Latest): popover_input_slot_->Assign(children_with_descendant_input);
Mason Freed . unresolved

Perhaps `DCHECK(RuntimeEnabledFeatures::FilterableSelectEnabled())`

Line 1989, Patchset 11 (Latest): children_with_descendant_input.push_back(child);
Mason Freed . unresolved

Ditto my comments from above here and below.

File third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc
Line 1329, Patchset 11 (Latest): if (slot.IsInUserAgentShadowRoot() &&
IsA<HTMLSelectElement>(slot.OwnerShadowHost()) &&
To<HTMLSelectElement>(slot.OwnerShadowHost())->UsesMenuList() &&
slot.GetIdAttribute() == shadow_element_names::kSelectOptions) {
return true;
}
Mason Freed . unresolved

nit:

```
if (auto select = DynamicTo<HTMLSelectElement>(slot.OwnerShadowHost());
select && select->UsesMenuList() &&
slot.IsInUserAgentShadowRoot() &&
slot.GetIdAttribute() == shadow_element_names::kSelectOptions) {
return true;
}
```
Open in Gerrit

Related details

Attention is currently required from:
  • Joey Arhar
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I3bcefdf33454a1f2fe5f1e858ef511c628a51bb4
    Gerrit-Change-Number: 7804742
    Gerrit-PatchSet: 11
    Gerrit-Owner: Joey Arhar <jar...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-Attention: Joey Arhar <jar...@chromium.org>
    Gerrit-Comment-Date: Mon, 11 May 2026 19:03:53 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Joey Arhar (Gerrit)

    unread,
    May 11, 2026, 5:54:20 PM (19 hours ago) May 11
    to Mason Freed, (Julie)Jeongeun Kim, Kevin Babbitt, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, devtools-re...@chromium.org, francisjp...@google.com, blink-rev...@chromium.org, dtseng...@chromium.org, blink-rev...@chromium.org, josiah...@chromium.org, kyungjunle...@google.com, nektar...@chromium.org, lucasrada...@google.com, yuzo+...@chromium.org, abigailbk...@google.com, blink-...@chromium.org
    Attention needed from Mason Freed

    Joey Arhar added 14 comments

    File third_party/blink/renderer/core/html/forms/html_select_element.cc
    Line 816, Patchset 11: return content_model_violations_count_ > 0U;
    Mason Freed . resolved

    nit: just `return content_model_violations_count_;`

    Joey Arhar

    Done

    Line 1570, Patchset 11: UserAgentShadowRoot()->SetNeedsAssignmentRecalc();
    Mason Freed . resolved

    Why is this needed? I'd have thought that the node removal at line 1567 would be enough. Is it because something is missing on ShadowRoot for this, perhaps? E.g. we have [Element::ChildrenChanged()](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/dom/element.cc;l=7824;drc=3da6fd070ba13b34eba5bc5bb3fd0bb6c2d1797f) which takes care of this for normal removals.

    Joey Arhar

    You're right, this isn't needed and I removed it.

    I originally added it while debugging something and there was another change which actually ended up fixing the underlying issue but this was leftover.

    Line 2147, Patchset 11: if (num_descendant_inputs_ == 1) {
    Mason Freed . resolved

    == 1 ? I'm guessing this is because we don't need to change the shadow structure after 1. Perhaps add a comment?

    Joey Arhar

    Done

    Line 2155, Patchset 11: if (num_descendant_inputs_ == 0) {
    Mason Freed . resolved

    nit: `!num_descendant_inputs_`

    Joey Arhar

    Done

    Line 2180, Patchset 11: UserAgentShadowRoot()->SetNeedsAssignmentRecalc();
    Mason Freed . resolved

    Again, here, it feels weird to have to manually call this. Do we know why it's needed?

    Joey Arhar

    i added a comment and added test coverage which will fail if this is removed

    Line 2206, Patchset 11: UserAgentShadowRoot()->SetNeedsAssignmentRecalc();
    Mason Freed . resolved

    ditto

    Joey Arhar

    Done

    File third_party/blink/renderer/core/html/forms/html_select_element_test.cc
    Line 1160, Patchset 11: EXPECT_TRUE(!!input_slot());
    Mason Freed . unresolved

    It feels a little weird to validate that the UpdateStyleAndLayout creates it. Maybe ok to leave, but it'll break if, e.g. we happen to update style and layout from the callbacks that happen above this point.

    Joey Arhar

    UpdateStyleAndLayout does not create this slot element, all the checks for its existence are before a call to UpdateStyleAndLayout. The Calls to UpdateStyleAndLayout are just to run slot assignment.

    File third_party/blink/renderer/core/html/forms/select_type.cc
    Line 632, Patchset 11: // <div role=listbox>
    Mason Freed . resolved

    uber-nit: close this `</div>`

    Joey Arhar

    Done

    Line 647, Patchset 11: popover_input_slot_ = nullptr;
    Mason Freed . resolved

    Maybe `CHECK(!select_->NumDescendantInputs())` ?

    Joey Arhar

    Done

    Line 681, Patchset 11: auto it = select_->ChildrenDescendantCounts().find(&child);
    Mason Freed . resolved

    Perhaps `DCHECK(!!popover_input_slot_)` ?

    Joey Arhar

    Done

    Line 683, Patchset 11: if (it->value.num_inputs && !it->value.num_options) {
    Mason Freed . resolved

    Maybe add a comment that the other situation (we have both) is handled elsewhere?

    Joey Arhar

    Done

    Line 705, Patchset 11: popover_input_slot_->Assign(children_with_descendant_input);
    Mason Freed . resolved

    Perhaps `DCHECK(RuntimeEnabledFeatures::FilterableSelectEnabled())`

    Joey Arhar

    Done

    Line 1989, Patchset 11: children_with_descendant_input.push_back(child);
    Mason Freed . resolved

    Ditto my comments from above here and below.

    Joey Arhar

    Done

    File third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc
    Line 1329, Patchset 11: if (slot.IsInUserAgentShadowRoot() &&

    IsA<HTMLSelectElement>(slot.OwnerShadowHost()) &&
    To<HTMLSelectElement>(slot.OwnerShadowHost())->UsesMenuList() &&
    slot.GetIdAttribute() == shadow_element_names::kSelectOptions) {
    return true;
    }
    Mason Freed . resolved

    nit:

    ```
    if (auto select = DynamicTo<HTMLSelectElement>(slot.OwnerShadowHost());
    select && select->UsesMenuList() &&
    slot.IsInUserAgentShadowRoot() &&
    slot.GetIdAttribute() == shadow_element_names::kSelectOptions) {
    return true;
    }
    ```
    Joey Arhar

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Mason Freed
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I3bcefdf33454a1f2fe5f1e858ef511c628a51bb4
    Gerrit-Change-Number: 7804742
    Gerrit-PatchSet: 12
    Gerrit-Owner: Joey Arhar <jar...@chromium.org>
    Gerrit-Reviewer: Joey Arhar <jar...@chromium.org>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-CC: (Julie)Jeongeun Kim <je_jul...@chromium.org>
    Gerrit-CC: Akihiro Ota <akihi...@chromium.org>
    Gerrit-CC: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-CC: Nektarios Paisios <nek...@chromium.org>
    Gerrit-Attention: Mason Freed <mas...@chromium.org>
    Gerrit-Comment-Date: Mon, 11 May 2026 21:54:04 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages