When putting in the changes to have the Select respond to changes to a ListOptionGroups slotted content, I made it so that if the selected option was removed, that the selectedIndex would get set to -1, and just have setDefaultSelectedOption handle setting the value. So, if a previous value had been set it was essentially forgotten about. This works except for the case where the value is set before any options have been slotted, which happens in an Angular environment commonly.
For now, I'm just removing the logic change and the two tests I wrote to verify the new behavior I was trying to promote. The result of this is that if one removes the selected option from a Select that it won't change its value. I don't think this is correct behavior (as the native select does not do this), so I will file an issue to track this problem, but will note the Angular case to ensure we don't repeat the same implementation.
🧪 Testing
Just removed some tests that were added along with the breaking change.
✅ Checklist
[ ] I have updated the project documentation to reflect my changes or determined no changes are needed.
Pull Request
🤨 Rationale
2175
👩💻 Implementation
When putting in the changes to have the
Select
respond to changes to aListOptionGroup
s slotted content, I made it so that if the selected option was removed, that theselectedIndex
would get set to -1, and just havesetDefaultSelectedOption
handle setting the value. So, if a previous value had been set it was essentially forgotten about. This works except for the case where the value is set before any options have been slotted, which happens in an Angular environment commonly.For now, I'm just removing the logic change and the two tests I wrote to verify the new behavior I was trying to promote. The result of this is that if one removes the selected option from a
Select
that it won't change its value. I don't think this is correct behavior (as the nativeselect
does not do this), so I will file an issue to track this problem, but will note the Angular case to ensure we don't repeat the same implementation.🧪 Testing
Just removed some tests that were added along with the breaking change.
✅ Checklist