Skip to content

Commit 8942715

Browse files
fix(select): ensure md-select selection logic uses fresh DOM references
Previously selectItem would work with cached references to select-option elements which could become stale causing the deactivation logic to fail. This cl just ensures that selectItem always re-fetches the nodes to avoid the issue. PiperOrigin-RevId: 595524158
1 parent 68b078b commit 8942715

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

select/internal/select.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,8 @@ export abstract class Select extends selectBaseClass {
725725
* @return Whether the last selected option has changed.
726726
*/
727727
private selectItem(item: SelectOption) {
728-
this.lastSelectedOptionRecords.forEach(([option]) => {
728+
const selectedOptions = this.getSelectedOptions() ?? [];
729+
selectedOptions.forEach(([option]) => {
729730
if (item !== option) {
730731
option.selected = false;
731732
}

0 commit comments

Comments
 (0)