Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DropDownMenu] buggy value prop check #1761

Closed
yulric opened this issue Sep 29, 2015 · 7 comments
Closed

[DropDownMenu] buggy value prop check #1761

yulric opened this issue Sep 29, 2015 · 7 comments
Labels
bug 🐛 Something doesn't work

Comments

@yulric
Copy link
Contributor

yulric commented Sep 29, 2015

Hi there,
When I use a SelectField component it looks like the value prop is ignored and the selectedIndex prop is used to set the DropdownMenu text. If this is the default functionality then the docs need to be updated.

Thanks,
Yulric

@shaurya947
Copy link
Contributor

I think you're right @yulric. The value prop means anything only for the text-field component it seems. Would you like to write a PR to update the docs?

@yulric
Copy link
Contributor Author

yulric commented Sep 29, 2015

Actually, sorry it's just a bug in the code. If you look at https://github.com/callemall/material-ui/blob/master/src/drop-down-menu.jsx#L185, we don't check if it is defined meaning that if we pass a value prop with a value of 0 (which is what I was doing) then it then doesn't go through the code which sets the value of selectedIndex, which is why I assumed that the value prop wasn't working. Sorry about that.

@shaurya947
Copy link
Contributor

Ah I missed that too. If 0 is a valid value then perhaps we should modify the if check there?

@yulric
Copy link
Contributor Author

yulric commented Sep 29, 2015

yeah I think it should be

if(value !== null && value !== undefined)

@shaurya947
Copy link
Contributor

PR welcome! :-)

@shaurya947 shaurya947 changed the title [SelectField] value prop is ignored [DropDownMenu] buggy value prop check Sep 29, 2015
@shaurya947 shaurya947 added the bug 🐛 Something doesn't work label Sep 29, 2015
@yulric
Copy link
Contributor Author

yulric commented Sep 29, 2015

Cool, I'll get one in by tonight I think.

yulric added a commit to yulric/material-ui that referenced this issue Sep 30, 2015
yulric added a commit to yulric/material-ui that referenced this issue Sep 30, 2015
@yulric
Copy link
Contributor Author

yulric commented Sep 30, 2015

Fixed in PR #1768

shaurya947 added a commit that referenced this issue Oct 1, 2015
@yulric yulric closed this as completed Oct 3, 2015
yulric added a commit to yulric/material-ui that referenced this issue Oct 16, 2015
yulric added a commit to yulric/material-ui that referenced this issue Oct 16, 2015
mnajdova pushed a commit to mnajdova/material-ui that referenced this issue Nov 10, 2020
* Improve input customization exprience and add new examples

* Remove data-mui-test from renderInput props

* Add missing prop-types for new props

* Remove inputProps import to properly treeskahe in production

* Improve docs of `renderInput`

* Remove 1-level import from '@material-ui/core'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work
Projects
None yet
Development

No branches or pull requests

2 participants