You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an item with empty value is selected previouslySelectedIndex is equal to -1 and code which clears selected styles won't fire. Which leads to incorrect behavior of getSelectedMenuItem here
You're right regarding the cause - this also came up in the second half of issue #5646 - marking as duplicate of that issue for now. Please follow that one for updates. Thanks!
Bug report
After setValue('element') call floating label stays in place and overlaps the selected element.
This only happens if the first element in a list has empty value (data-value="").
Steps to reproduce
https://codepen.io/RomanPaulov/pen/XWbqbZg
Actual behavior
Expected behavior
Screenshots
Your Environment:
Possible solution
This behavior caused by this line I think
material-components-web/packages/mdc-select/foundation.ts
Line 136 in cd53918
When an item with empty value is selected previouslySelectedIndex is equal to -1 and code which clears selected styles won't fire. Which leads to incorrect behavior of getSelectedMenuItem here
material-components-web/packages/mdc-select/component.ts
Line 292 in cd53918
which picks first list item with mdc-list-item--selected class is present, which will be the first item.
The text was updated successfully, but these errors were encountered: