Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bbdd9697028da9dd442e28223f80c11a0429058e
https://github.com/WebKit/WebKit/commit/bbdd9697028da9dd442e28223f80c11a0429058e
Author: Anne van Kesteren <[email protected]>
Date: 2026-10-01 (Thu, 01 Oct 2026)
Changed paths:
A LayoutTests/fast/forms/select/listbox-drag-from-padding-expected.txt
A LayoutTests/fast/forms/select/listbox-drag-from-padding.html
A
LayoutTests/fast/forms/select/listbox-keyboard-navigation-after-options-removed-expected.txt
A
LayoutTests/fast/forms/select/listbox-keyboard-navigation-after-options-removed.html
A
LayoutTests/fast/forms/select/listbox-multiple-autoscroll-after-enabling-expected.txt
A
LayoutTests/fast/forms/select/listbox-multiple-autoscroll-after-enabling.html
A
LayoutTests/fast/forms/select/listbox-multiple-autoscroll-after-option-disabled-expected.txt
A
LayoutTests/fast/forms/select/listbox-multiple-autoscroll-after-option-disabled.html
A
LayoutTests/fast/forms/select/listbox-multiple-autoscroll-after-options-change-expected.txt
A
LayoutTests/fast/forms/select/listbox-multiple-autoscroll-after-options-change.html
A
LayoutTests/fast/forms/select/listbox-multiple-autoscroll-from-padding-expected.txt
A
LayoutTests/fast/forms/select/listbox-multiple-autoscroll-from-padding.html
A
LayoutTests/fast/forms/select/listbox-multiple-shift-click-with-optgroup-expected.txt
A
LayoutTests/fast/forms/select/listbox-multiple-shift-click-with-optgroup.html
A
LayoutTests/fast/forms/select/listbox-multiple-space-after-options-removed-expected.txt
A
LayoutTests/fast/forms/select/listbox-multiple-space-after-options-removed.html
M LayoutTests/platform/ios/TestExpectations
M Source/WebCore/html/HTMLSelectElement.cpp
M Source/WebCore/html/HTMLSelectElement.h
M Source/WebCore/rendering/RenderListBox.cpp
Log Message:
-----------
ASSERTION FAILED: !listItems().size() || m_activeSelectionAnchorIndex >= 0
https://bugs.webkit.org/show_bug.cgi?id=325122
rdar://188888962
Reviewed by Ryosuke Niwa.
Autoscrolling a multiple-selection list box extended the selection from its
anchor without checking that there is one. Only a press on an option or the
keyboard sets the anchor, and changing the options resets it, so autoscrolling
could happen without one after the options changed during a drag, or after a
press in the padding or on a disabled list box. Dragging inside the list box has
checked for the anchor since 118165@main, and autoscrolling now shares that
code.
A drag now also leaves the selection alone unless pressing an option or
selecting
with the keyboard saved the selection since the options last changed. Before, a
drag that started in the padding of a list box nobody had used yet deselected
every option, because nothing had decided yet whether a drag selects or
deselects. Stopping autoscroll then fired a change event even when the selection
was unchanged. It now skips the change event in that case, as releasing the
mouse
button without autoscroll already did. A drag therefore also stops changing the
selection once the options change, and releasing it fires no change event.
Changing the options reset the selection anchor but not the end of the
selection, so arrow keys then moved from an index that could point at another
option or past the end of the list, which asserted. Changing the options now
resets the end too, so arrow keys move from the selected options, and leaves the
non-contiguous selection mode, in which space toggles the option at the end.
Shift-clicking without an anchor used the index of the first selected option as
a list index, so the range started too early when an <optgroup> preceded that
option.
Three of the tests are based on ones Alexey Proskuryakov attached to the bug.
Tests: fast/forms/select/listbox-drag-from-padding.html
fast/forms/select/listbox-keyboard-navigation-after-options-removed.html
fast/forms/select/listbox-multiple-autoscroll-after-enabling.html
fast/forms/select/listbox-multiple-autoscroll-after-option-disabled.html
fast/forms/select/listbox-multiple-autoscroll-after-options-change.html
fast/forms/select/listbox-multiple-autoscroll-from-padding.html
fast/forms/select/listbox-multiple-shift-click-with-optgroup.html
fast/forms/select/listbox-multiple-space-after-options-removed.html
Canonical link: https://commits.webkit.org/322465@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications