[Bug]: SfSelect uses selected attribute for placeholder option
dkacper opened this issue · 1 comments
dkacper commented
Describe the Bug
When using placeholder
on SfSelect component I receive an error in the console that says I should not use selected
attribute on the select element. I discovered the bug in React, but I think it applies to Vue as well.
![SfSelect error](https://private-user-images.githubusercontent.com/34419118/254181075-814f0abf-2edf-4b6d-84a5-7593032dd718.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MDc3ODg0ODQsIm5iZiI6MTcwNzc4ODE4NCwicGF0aCI6Ii8zNDQxOTExOC8yNTQxODEwNzUtODE0ZjBhYmYtMmVkZi00YjZkLTg0YTUtNzU5MzAzMmRkNzE4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMjEzVDAxMzYyNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg2NjIyYTMyZjFhZDdlYTZjZDY5NjAwOGVhN2RiNWUwY2JiNTBkNTE5YzNjMWQ3MmRiMjYxN2VkZjI0YWFhMzYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.5M5N5EKBhDLE-v5Yam0QocKHLTLke1eMTiXCLS-hzR0)
Expected behavior
No errors in the console. According to the error message, placeholder should use defaultValue
or value
on the select element.
Steps to reproduce
- Run React app.
- Use
SfSelect
with anyplaceholder
- See the console.
I'm currently using SFUI v2.2.0, but I can still see this on the v2 master branch. https://github.com/vuestorefront/storefront-ui/blob/v2-develop/packages/sfui/frameworks/react/components/SfSelect/SfSelect.tsx#L67
SFUI version
2.2.0
Framework
React, Next 13
Node version
20
Browser
Brave, Chrome
OS
macOS
Relevant log output
No response
Able to fix / change the documentation?
- Yes
- No
Code of Conduct
- I agree to follow this project's Code of Conduct
Szymon-dziewonski commented